Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function setupPlugins(template) {
const htmlPluginOptions = {
title: last(process.cwd().split(path.sep))
};
if (template) {
htmlPluginOptions.template = template;
}
return [
new HtmlWebpackPlugin(htmlPluginOptions),
new NpmInstallPlugin({
save: false,
saveDev: false,
saveExact: false
}),
new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compressor: {
screw_ie8: true,
warnings: false
},
mangle: {
screw_ie8: true
},
output: {
}].filter(loader => loader)
},
plugins: [
new HappyPack({
loaders: ['babel'],
threads: 4,
verbose: false,
cache: true
}),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
].concat(debug ? [
new NpmInstallPlugin({saveDev: true}),
new webpack.HotModuleReplacementPlugin()
] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({compress: {warnings: false}, output: {comments: false}})
]),
eslint: {
configFile: path.join(__dirname, '.eslintrc'),
emitErrors: false,
emitWarning: true,
formatter: eslintFormatter({notify})
}
};
}