Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问下,iview-cli生成的项目,怎么配置BASE_API和NODE_ENV这些呢? #42

Open
moonshineBoy opened this issue May 15, 2018 · 0 comments

Comments

@moonshineBoy
Copy link

我们知道如果使用典型webpack生成项目,那么会有三个文件在config文件夹下:

.
├── dev.env.js
├── index.js
└── prod.env.js

我们可以在不同的环境去配置不同的文件:
dev.env.js:

'use strict'
const merge = require('webpack-merge')
const prodEnv = require('./prod.env')

module.exports = merge(prodEnv, {
  NODE_ENV: '"development"',
  BASE_API: '"http://localhost:8000/"'
})

prod.env.js:

'use strict'

const MODEL = require('../static/config.js')
const pro= {
  NODE_ENV: '"production"',
  BASE_API: 'http://103.200.32.76/'
}
module.exports =Object.assign({}, pro, MODEL)

但是如果iview-cli生成的文件是这样的:

.
├── config.js
└── env.js

env.js:

export default "development";

config.js

import Env from './env';

let config = {
  env: Env
};
export default config;

请问怎么配置呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant