iview / iview/iview-cli

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

Open
#42 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
721
Forks
139
PR merge metrics
No merged PRs in 30d

Description

我们知道如果使用典型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;
```
请问怎么配置呢?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the generated config.js and env.js files, then inspect the iview-cli project-generation entry points to determine how environment values are selected. Confirm whether BASE_API and NODE_ENV are supported and where users should configure them; done means the configuration path is clear in the generated project and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system, cli
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.