Skip to content

Commit d1b18bb

Browse files
authored
Merge pull request #390 from BeAPI/fix/webpack-bundle-analyser
fix (bundle-report-analyser): make it work
2 parents 4cb4e2d + 68e6af0 commit d1b18bb

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

config/plugins.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const StyleLintPlugin = require('stylelint-webpack-plugin')
88
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin')
99
const WebpackBar = require('webpackbar')
1010
const DependencyExtractionWebpackPlugin = require('@wordpress/dependency-extraction-webpack-plugin')
11+
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
1112

1213
const browsersyncConfig = require('./browsersync.config')
1314

@@ -35,6 +36,12 @@ module.exports = {
3536
]
3637

3738
if (mode === 'production') {
39+
plugins.push(
40+
new BundleAnalyzerPlugin({
41+
analyzerMode: 'json',
42+
generateStatsFile: true,
43+
})
44+
)
3845
plugins.push(
3946
new WebpackManifestPlugin({
4047
fileName: 'assets.json',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"lint:css": "node_modules/.bin/stylelint \"src/scss/**/*.scss\"",
1313
"lint:js": "node_modules/.bin/eslint \"src/js/**/*.js\"",
1414
"lint": "node_modules/.bin/concurrently \"yarn lint:css\" \"yarn lint:js\"",
15-
"bundle-report": "yarn webpack --config config/webpack.prod.js --json=dist/stats.json && yarn webpack-bundle-analyzer dist/stats.json",
15+
"bundle-report": "yarn build && yarn webpack-bundle-analyzer dist/stats.json",
1616
"image": "yarn node config/image-sizes.js"
1717
},
1818
"license": "GPL-2.0",

src/js/index.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,6 @@
1-
import lazySizes from 'lazysizes'
2-
import 'lazysizes/plugins/native-loading/ls.native-loading'
3-
import 'lazysizes/plugins/object-fit/ls.object-fit'
1+
import 'lazysizes'
42
import 'lazysizes/plugins/print/ls.print'
53
import './classes/ScrollDirection'
64
import './classes/ButtonSeoClick'
75
import './classes/Header'
86
import './classes/Animation'
9-
10-
/**
11-
* LazySizes configuration
12-
* https://github.com/aFarkas/lazysizes/#js-api---options
13-
*/
14-
lazySizes.cfg.nativeLoading = {
15-
setLoadingAttribute: false,
16-
}

0 commit comments

Comments
 (0)