Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
]
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.DefinePlugin({
// Signal production, so that webpack removes non-production code that
// is in condtionals like: `if (process.env.NODE_ENV === "production")`
"process.env.NODE_ENV": JSON.stringify("production")
}),
new webpack.SourceMapDevToolPlugin("[file].map")
]
};
gulp.task('webpack-dev-server', () => {
// modify some webpack config options
const myConfig = Object.create(webpackConfig);
myConfig.plugins.push(new webpack.SourceMapDevToolPlugin({}));
// Start a webpack-dev-server
new WebpackDevServer(webpack(myConfig), {
publicPath: `http://127.0.0.1:${port}/build/`,
stats: {
colors: true,
},
}).listen(port, '127.0.0.1', (err) => {
if (err) throw new gutil.PluginError('webpack-dev-server', err);
opn(`http://127.0.0.1:${port}/`);
gutil.log('[webpack-dev-server]', `http://127.0.0.1:${port}/webpack-dev-server/index.html`);
});
});
}
]
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.DefinePlugin({
// Signal production, so that webpack removes non-production code that
// is in condtionals like: `if (process.env.NODE_ENV === "production")`
"process.env.NODE_ENV": JSON.stringify("production")
}),
new webpack.SourceMapDevToolPlugin("[file].map")
]
};
}
]
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.DefinePlugin({
// Signal production, so that webpack removes non-production code that
// is in condtionals like: `if (process.env.NODE_ENV === "production")`
"process.env.NODE_ENV": JSON.stringify("production")
}),
new webpack.SourceMapDevToolPlugin("[file].map")
]
};
'xregexp': 'xregexp/src/xregexp',
},
},
module: {
loaders: [
{
test: [/\.js$/, /\.es6$/],
loader: 'babel',
},
],
},
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({ comments: false }),
new webpack.BannerPlugin(banner),
new webpack.SourceMapDevToolPlugin({
filename: 'syntaxhighlighter.js.map',
append: '\n//# sourceMappingURL=[url]',
}),
]
};
return fs.promise.rename(corePath, backupCorePath)
.then(() => fs.promise.writeFile(corePath, core))
.then(() => webpack.promise(config))
.then(stats =>
fs.promise.unlink(corePath)
.then(() => fs.promise.rename(backupCorePath, corePath))
.then(() => stats)
);
}
})
);
}
if ([MODE.TEST, MODE.DEMO_JIT, MODE.DEMO_AOT].includes(this.mode)) {
out.push(
new webpack.ContextReplacementPlugin(
/angular[\/\\]core/,
path.join(__dirname, 'src')
)
);
}
if (this.mode === MODE.TEST) {
out.push(
new webpack.SourceMapDevToolPlugin({
filename: null,
test: /\.(ts|js)($|\?)/i
})
);
out.push(new webpack.NoEmitOnErrorsPlugin());
}
return out;
}
function getDevelopmentConfig() {
return {
module: {
rules: [
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader', exclude: [ root('node_modules') ] }
]
},
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: '[file].map[query]',
moduleFilenameTemplate: '[resource-path]',
fallbackModuleFilenameTemplate: '[resource-path]?[hash]',
sourceRoot: 'webpack:///'
}),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.optimize.CommonsChunkPlugin({
minChunks: Infinity,
name: 'inline'
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
chunks: ['app'],
minChunks: module => {
return module.resource && module.resource.startsWith(nodeModules)
use: {
loader: 'url-loader',
query: {
limit: 10000
}
}
}
]
},
resolve: {
modules: [path.resolve(__dirname, "node_modules")]
}
};
if (env === 'dev') {
config.plugins.push(new webpack.SourceMapDevToolPlugin({
exclude: ["coreapps.vendor.js"]
}));
} else if (env === 'prod') {
config.devtool = 'source-map';
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}));
}
module.exports = config;