page-skeleton-webpack-plugin
page-skeleton-webpack-plugin copied to clipboard
feat: 支持 NODE_ENV 多环境变量
| Q | A |
|---|---|
| Bug fix? | no |
| New feature? | yes |
| BC breaks? | no |
| Deprecations? | no |
| New tests added? | not needed |
| License | MIT |
Description
[Description of the feature] NODE_ENV 环境可配置,有一种情况是这样的
- development: 开发环境
- develop: 线上开发环境
- test:线上测试环境
- production:正式环境
develop,test,production 都是需要构建成 dist bundle 的,目前skeletonPlugin.js#L32 中只要是非 production 环境 都会插入script 引入动态骨架文件, skeletonPlugin.js#L12 不会close 掉 skeleton server
使用方法
new SkeletonPlugin({
productionMode: ['develop', 'test', 'staging', 'production'],
pathname: path.resolve(__dirname, '../shell')
staticDir: path.resolve(__dirname, '../dist')
...
})
以上设置便可以在 NODE_ENV 为 ['develop', 'test', 'staging', 'production'] 其中一种的情况下,都可构建出生产环境下的 bundle。