1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-04-30 15:37:48 +02:00

remove assets, favicon, preload tags

This commit is contained in:
Kushagra Gour 2018-06-22 14:45:15 +05:30
parent 2e90fa9ae1
commit 2b8e773e03
8 changed files with 21 additions and 16 deletions

View File

@ -1,4 +1,4 @@
import CopyWebpackPlugin from 'copy-webpack-plugin'
import CopyWebpackPlugin from 'copy-webpack-plugin';
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 {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) {
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(
new CommonsChunkPlugin({
name: 'vendor',
minChunks: ({
resource
}) => /node_modules/.test(resource),
minChunks: ({ resource }) => /node_modules/.test(resource)
})
);
const swPlugin = helpers.getPluginsByName(config, 'SWPrecacheWebpackPlugin')[0];
config.plugins.splice(swPlugin.index, 1)
const swPlugin = helpers.getPluginsByName(
config,
'SWPrecacheWebpackPlugin'
)[0];
config.plugins.splice(swPlugin.index, 1);
const uglifyPlugin = helpers.getPluginsByName(config, 'UglifyJsPlugin')[0]
config.plugins.splice(uglifyPlugin.index, 1)
const uglifyPlugin = helpers.getPluginsByName(config, 'UglifyJsPlugin')[0];
config.plugins.splice(uglifyPlugin.index, 1);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB