remove assets, favicon, preload tags
@ -1,4 +1,4 @@
|
|||||||
import CopyWebpackPlugin from 'copy-webpack-plugin'
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
||||||
var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
|
var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,30 +9,35 @@ var CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');
|
|||||||
* @param {object} env - options passed to CLI.
|
* @param {object} env - options passed to CLI.
|
||||||
* @param {WebpackConfigHelpers} helpers - object with useful helpers when working with config.
|
* @param {WebpackConfigHelpers} helpers - object with useful helpers when working with config.
|
||||||
**/
|
**/
|
||||||
export default function (config, env, helpers) {
|
export default function(config, env, helpers) {
|
||||||
|
const htmlWebpackPlugin = helpers.getPluginsByName(
|
||||||
|
config,
|
||||||
|
'HtmlWebpackPlugin'
|
||||||
|
)[0];
|
||||||
|
Object.assign(htmlWebpackPlugin.plugin.options.minify, {
|
||||||
|
removeComments: false,
|
||||||
|
collapseWhitespace: false
|
||||||
|
});
|
||||||
|
htmlWebpackPlugin.plugin.options.preload = false;
|
||||||
|
htmlWebpackPlugin.plugin.options.favicon = false;
|
||||||
|
|
||||||
if (env.isProd) {
|
if (env.isProd) {
|
||||||
config.devtool = false; // disable sourcemaps
|
config.devtool = false; // disable sourcemaps
|
||||||
|
|
||||||
const htmlWebpackPlugin = helpers.getPluginsByName(config, 'HtmlWebpackPlugin')[0];
|
|
||||||
Object.assign(htmlWebpackPlugin.plugin.options.minify, {
|
|
||||||
removeComments: false,
|
|
||||||
collapseWhitespace: false
|
|
||||||
})
|
|
||||||
|
|
||||||
config.plugins.push(
|
config.plugins.push(
|
||||||
new CommonsChunkPlugin({
|
new CommonsChunkPlugin({
|
||||||
name: 'vendor',
|
name: 'vendor',
|
||||||
minChunks: ({
|
minChunks: ({ resource }) => /node_modules/.test(resource)
|
||||||
resource
|
|
||||||
}) => /node_modules/.test(resource),
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const swPlugin = helpers.getPluginsByName(config, 'SWPrecacheWebpackPlugin')[0];
|
const swPlugin = helpers.getPluginsByName(
|
||||||
config.plugins.splice(swPlugin.index, 1)
|
config,
|
||||||
|
'SWPrecacheWebpackPlugin'
|
||||||
|
)[0];
|
||||||
|
config.plugins.splice(swPlugin.index, 1);
|
||||||
|
|
||||||
const uglifyPlugin = helpers.getPluginsByName(config, 'UglifyJsPlugin')[0]
|
const uglifyPlugin = helpers.getPluginsByName(config, 'UglifyJsPlugin')[0];
|
||||||
config.plugins.splice(uglifyPlugin.index, 1)
|
config.plugins.splice(uglifyPlugin.index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 50 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 626 B |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 8.8 KiB |