webpack.config.js 394 B

123456789101112131415
  1. const { merge } = require('webpack-merge')
  2. const config = require('./webpack.common.js')
  3. let isDev = false
  4. try {
  5. const buildMode = process.env.NODE_ENV
  6. isDev = buildMode === 'development'
  7. } catch (e) {
  8. console.error('Could not determine build mode', e)
  9. }
  10. module.exports = merge(config, {
  11. mode: isDev ? 'development' : 'production',
  12. devtool: isDev ? 'cheap-source-map' : 'source-map',
  13. })