Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
hot: true,
host: '0.0.0.0',
port: 8080
};
// modify some webpack config configuration
const myConfig = Object.create(myWebpackConfig);
// The two following properties helps having an easy debuggable map file.
myConfig.devtool = 'eval';
myConfig.debug = true;
myConfig.output.pathinfo = true;
// Add hot reload.
myConfig.plugins.push(new webpack.HotModuleReplacementPlugin());
// Notify on build.
myConfig.plugins.push(new WebpackNotifierPlugin({ title: 'Webpack', excludeWarnings: true }));
// Open the browser on dev server launch.
myConfig.plugins.push(new WebpackOpenBrowserPlugin({ url: `http://${devConf.host}:${devConf.port}/examples/index.html` }));
// Start a webpack-dev-server
new WebpackDevServer(webpack(myWebpackConfig), devConf)
.listen(devConf.port, devConf.host, (err) => {
if (err) {
throw new gutil.PluginError('webpack-dev-server', err);
}
gutil.log('[webpack-dev-server]', `http://${devConf.host}:${devConf.port}/examples/index.html`);
callback();
});
});
};
if (devMode) {
options.devtool = "inline-source-map";
options.debug = "true";
// These lines break the build into two chunks, one for our code, and one for all our dependencies
// This allows for a faster rebuild time
options.plugins.push(new webpack.optimize.CommonsChunkPlugin("vendor", "externalDeps.js"));
options.entry.vendor = ["react", "lodash", "bluebird", "mathjs", "immutable", "fluxxor", "d3"];
}
return options;
});
// Hack: add Timestamp to the WebPack build message.
WebpackNotifierPlugin.prototype._compileMessage = WebpackNotifierPlugin.prototype.compileMessage;
WebpackNotifierPlugin.prototype.compileMessage = function (stats) {
var msg = this._compileMessage(stats);
if (msg === "Build successful") {
msg += " @ " + (new Date()).toLocaleTimeString();
}
return msg;
};
module.exports = buildConfigs;
if (devMode) {
options.devtool = "inline-source-map";
options.debug = "true";
// These lines break the build into two chunks, one for our code, and one for all our dependencies
// This allows for a faster rebuild time
options.plugins.push(new webpack.optimize.CommonsChunkPlugin("vendor", "externalDeps.js"));
options.entry.vendor = ["react", "lodash", "bluebird", "mathjs", "immutable", "fluxxor", "d3"];
}
return options;
});
// Hack: add Timestamp to the WebPack build message.
WebpackNotifierPlugin.prototype._compileMessage = WebpackNotifierPlugin.prototype.compileMessage;
WebpackNotifierPlugin.prototype.compileMessage = function (stats) {
var msg = this._compileMessage(stats);
if (msg === "Build successful") {
msg += " @ " + (new Date()).toLocaleTimeString();
}
return msg;
};
module.exports = buildConfigs;
filter: file => file.isInitial,
}),
new StyleLintPlugin({ failOnError: stylelint }),
new webpack.EnvironmentPlugin({ NODE_ENV: JSON.stringify(nodeEnv) }),
new webpack.DefinePlugin({
__CLIENT__: true,
__SERVER__: false,
__DEV__: isDev,
__INJECT_HTML__: injectHtml,
__APP_ENV__: JSON.stringify(appEnv),
}),
new FriendlyErrorsWebpackPlugin(),
];
if (isDev) {
plugins.push(new WebpackNotifierPlugin({
excludeWarnings: true,
title: `${process.env.PWD.split('/').pop()}`,
}));
plugins.push(new webpack.HotModuleReplacementPlugin());
} else {
plugins.push(
new webpack.HashedModuleIdsPlugin(),
new CompressionPlugin({
asset: '[path].gz[query]',
algorithm: 'gzip',
test: /\.jsx?$|\.css$|\.(scss|sass)$|\.html$/,
threshold: 10240,
minRatio: 0.8,
}),
new ImageminPlugin({
pngquant: { quality: '95-100' },
function getCompiler(verbose=true, production=false) {
const config = webpackUtil.getBaseConfig(); {
config.entry = {
'jews': 'jews'
};
config.output = {
path: path.resolve(__dirname, '../dist'),
filename: 'jews.user.js'
};
config.plugins.push(
new JewsEmitter(production)
);
if (verbose) {
config.plugins.push(
new WebpackNotifierPlugin({ title: 'jews', alwaysNotify: true })
);
}
if (production) {
config.plugins.push(
new UglifyJsPlugin({
compress: {
screw_ie8: true
}
})
);
}
}
return webpack(config);
}
injectType: 'lazyStyleTag',
},
},
'css-loader',
'sass-loader',
],
});
config.plugins.push(
new StyleLintPlugin({
syntax: 'scss',
context: path.join(__dirname, dir),
}),
);
config.plugins.push(
new WebpackNotifierPlugin({
alwaysNotify: true,
emoji: true,
}),
);
config.plugins.push(new PrismLanguageGenerationPlugin());
config.plugins.push(
new DependencyExtractionWebpackPlugin({
outputFormat: 'json',
combineAssets: true,
combinedOutputFile: `wp-assets${isProd(state) ? '.min' : ''}.json`,
}),
);
if (isProd(state)) {
config.plugins[0].opts.fileName = 'asset-manifest.min.json';
config.plugins.push(