@s-ui/bundler 9.23.0 → 9.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,58 +4,25 @@
4
4
  const webpack = require('webpack')
5
5
  const log = require('../shared/log.js')
6
6
  const config = require('../webpack.config.prod.js')
7
- const {getSpawnPromise} = require('@s-ui/helpers/cli')
8
- const logUpdate = require('@s-ui/helpers/log-update')
9
-
10
- const installNeededDependencies = async () => {
11
- try {
12
- require('webpack-bundle-analyzer')
13
- return true
14
- } catch (e) {
15
- logUpdate('Installing needed dependencies...')
16
- return getSpawnPromise('npm', [
17
- 'install',
18
- '--no-save',
19
- '--no-audit',
20
- '--no-fund',
21
- 'webpack-bundle-analyzer@4.5.0 duplicate-package-checker-webpack-plugin@3.0.0'
22
- ]).then(() => {
23
- logUpdate.done('Installed needed dependencies')
24
- getSpawnPromise('./node_modules/.bin/sui-bundler', ['analyzer']).then(
25
- () => false
26
- )
27
- })
28
- }
29
- }
7
+ const fs = require('fs')
8
+ const {getSpawnPromise} = require('@s-ui/helpers/cli.js')
30
9
 
31
10
  ;(async () => {
32
- const keepExecution = await installNeededDependencies()
33
- if (!keepExecution) return
34
-
35
- const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer')
36
- const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin')
37
-
38
- config.plugins.push(new BundleAnalyzerPlugin())
39
- config.plugins.push(
40
- new DuplicatePackageCheckerPlugin({
41
- verbose: true, // Show module that is requiring each duplicate package
42
- emitError: false // Avoid emit errors, just a warning
43
- })
44
- )
45
-
46
11
  log.processing('🔎 Analyzing Bundle...\n')
47
- webpack(config).run((error, stats) => {
12
+ webpack({...config, profile: true, stats: true}).run((error, stats) => {
48
13
  if (error) {
49
14
  log.error('Error analyzing the build')
50
15
  throw new Error(error)
51
16
  }
52
17
 
53
- log.success('Bundle analyzed successfully')
18
+ log.success('Compilation done!')
54
19
 
55
- if (stats.hasErrors() || stats.hasWarnings()) {
56
- const jsonStats = stats.toJson('errors-warnings')
57
- jsonStats.warnings.map(log.warn)
58
- jsonStats.errors.map(log.error)
59
- }
20
+ const filePath = `${process.cwd()}/public/stats.json`
21
+
22
+ fs.writeFileSync(filePath, JSON.stringify(stats.toJson()), {
23
+ encoding: 'utf8'
24
+ })
25
+
26
+ getSpawnPromise('npx --yes webpack-bundle-analyzer', [filePath])
60
27
  })
61
28
  })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s-ui/bundler",
3
- "version": "9.23.0",
3
+ "version": "9.26.0",
4
4
  "description": "Config-free bundler for ES6 React apps.",
5
5
  "bin": {
6
6
  "sui-bundler": "./bin/sui-bundler.js"
@@ -32,7 +32,7 @@
32
32
  "commander": "8.3.0",
33
33
  "css-loader": "6.7.1",
34
34
  "css-minimizer-webpack-plugin": "4.0.0",
35
- "esbuild": "0.14.42",
35
+ "esbuild": "0.14.43",
36
36
  "escape-string-regexp": "4.0.0",
37
37
  "fast-glob": "3.2.11",
38
38
  "find-free-ports": "3.0.0",
@@ -42,13 +42,13 @@
42
42
  "postcss": "8.4.14",
43
43
  "postcss-loader": "7.0.0",
44
44
  "process": "0.11.10",
45
- "sass": "1.52.1",
45
+ "sass": "1.52.2",
46
46
  "stream-http": "3.2.0",
47
47
  "strip-ansi": "6.0.1",
48
48
  "style-loader": "3.3.1",
49
49
  "url": "0.11.0",
50
- "webpack": "5.72.1",
51
- "webpack-dev-server": "4.9.1",
50
+ "webpack": "5.73.0",
51
+ "webpack-dev-server": "4.9.2",
52
52
  "webpack-manifest-plugin": "5.0.0",
53
53
  "webpack-node-externals": "3.0.0"
54
54
  }
@@ -74,10 +74,7 @@ const webpackConfig = {
74
74
  minimizer: [minifyJs({extractComments, sourceMap}), minifyCss()].filter(
75
75
  Boolean
76
76
  ),
77
- runtimeChunk: true,
78
- splitChunks: {
79
- chunks: 'all'
80
- }
77
+ runtimeChunk: true
81
78
  },
82
79
  plugins: cleanList([
83
80
  new webpack.ProvidePlugin({