We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
思考一下,如果一些配置,在项目中多处使用,如果有修改,仅改此一处就ok。是不是省心省力? 如果有一些配置,在开发环境和发布环境不一样,怎么办?在发布前修改代码?是不是闹心? 设计配置文件大概解决如上两个问题。
通过webpack的alias,开发和发布时,加载不同文件来解决开发和发布两个环境的配置不一样的问题
resolve: { extensions: ['.js', '.vue', '.json'], alias: { 'cfg':process.env.NODE_ENV === 'production' ? path.join(__dirname, '..', 'src/config/build.js') : path.join(__dirname, '..', 'src/config/dev.js') } }
import cfg from 'cfg'; console.log(cfg.XXX);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
使用场景
思考一下,如果一些配置,在项目中多处使用,如果有修改,仅改此一处就ok。是不是省心省力?
如果有一些配置,在开发环境和发布环境不一样,怎么办?在发布前修改代码?是不是闹心?
设计配置文件大概解决如上两个问题。
规范
原理解释
通过webpack的alias,开发和发布时,加载不同文件来解决开发和发布两个环境的配置不一样的问题
使用方法
The text was updated successfully, but these errors were encountered: