ElemeFE / page-skeleton-webpack-plugin

Webpack plugin to generate the skeleton page automatically
MIT License
2.79k stars 393 forks source link

feat: 支持 NODE_ENV 多环境变量 #110

Closed kingzez closed 1 year ago

kingzez commented 5 years ago
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 环境可配置,有一种情况是这样的

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。