VirtualModulesPlugin

cross-env RELEASE=production

const VirtualModulesPlugin = require('webpack-virtual-modules');

new VirtualModulesPlugin({
      'node_modules/module-env.js': `module.exports = { env: ${process.env.RELEASE || 0} };`
    })
const moduleEnv = require('module-env')

if (moduleEnv.env === 'production') {
  console.log('Sentry')
  Sentry.init(...);
}
张贴在未分类