webpack.config.js 628 B

1234567891011121314151617181920212223242526
  1. const webpackMerge = require('webpack-merge');
  2. const webpackCommonConfig = require('./webpack.config.common');
  3. const webpackDevConfig = require('./webpack.config.dev');
  4. const webpackProdConfig = require('./webpack.config.prod');
  5. const MODE = {
  6. DEV: 'development',
  7. ALPHA: 'none',
  8. PROD: 'production',
  9. };
  10. module.exports = function (env, argv) {
  11. const { mode } = argv;
  12. switch (mode) {
  13. case MODE.DEV:
  14. return webpackMerge(webpackCommonConfig, webpackDevConfig);
  15. case MODE.PROD:
  16. return webpackMerge(webpackCommonConfig, webpackProdConfig);
  17. default:
  18. throw new Error('invalid MODE');
  19. }
  20. };