@s-ui/bundler 7.36.0-beta.0 → 8.0.0-beta.1
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.
- package/README.md +6 -5
- package/bin/sui-bundler-build.js +3 -2
- package/loaders/linkLoaderConfigBuilder.js +2 -7
- package/package.json +5 -5
- package/shared/config.js +1 -1
- package/webpack.config.dev.js +18 -11
- package/webpack.config.prod.js +4 -15
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# sui-
|
|
1
|
+
# sui-bundler
|
|
2
2
|
|
|
3
3
|
> Config-free bundler for ES6 React apps.
|
|
4
4
|
|
|
@@ -186,8 +186,7 @@ This tool works with zero configuration out the box but you could use some confi
|
|
|
186
186
|
},
|
|
187
187
|
"optimizations": {
|
|
188
188
|
"splitFrameworkOnChunk": true,
|
|
189
|
-
"useExperimentalMinifier": true
|
|
190
|
-
"useExperimentalSCSSLoader": true
|
|
189
|
+
"useExperimentalMinifier": true
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
}
|
|
@@ -323,10 +322,12 @@ You could tweak the performance of your bundle generation by using some flags pr
|
|
|
323
322
|
|
|
324
323
|
`useExperimentalMinifier` (default: `false`): Use `esbuild-loader` to minify JavaScript and CSS instead using `terser` and `css-minimizer-webpack-plugin` in order to boost build time and memory usage.
|
|
325
324
|
|
|
326
|
-
`useExperimentalSCSSLoader` (default: `false`): Use [fast-sass-loader](https://github.com/yibn2008/fast-sass-loader) (currently a fork of it [super-sass-loader](https://github.com/andresz1/super-sass-loader)) instead of `sass-loader` (available in development only)
|
|
327
|
-
|
|
328
325
|
## Migrations
|
|
329
326
|
|
|
327
|
+
### Migrate from v7 to v8
|
|
328
|
+
|
|
329
|
+
`useExperimentalSCSSLoader` is not used anymore and it will be ignored.
|
|
330
|
+
|
|
330
331
|
### Migrate from v6 to v7
|
|
331
332
|
|
|
332
333
|
- In order to keep same config object across all `sui` tools, `sui-bundler` config has been moved from package.json root to the `config` property.
|
package/bin/sui-bundler-build.js
CHANGED
|
@@ -66,13 +66,14 @@ webpack(nextConfig).run(async (error, stats) => {
|
|
|
66
66
|
|
|
67
67
|
if (stats.hasErrors()) {
|
|
68
68
|
const jsonStats = stats.toJson('errors-only')
|
|
69
|
-
return jsonStats.errors.map(log.error)
|
|
69
|
+
return jsonStats.errors.map(({message}) => log.error(message))
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
if (stats.hasWarnings()) {
|
|
73
73
|
const jsonStats = stats.toJson('errors-warnings')
|
|
74
74
|
log.warn('Webpack generated the following warnings: ')
|
|
75
|
-
jsonStats.warnings
|
|
75
|
+
log.warn(jsonStats.warnings)
|
|
76
|
+
jsonStats.warnings.map(({message}) => log.warn(message))
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
console.log(`Webpack stats: ${stats}`)
|
|
@@ -6,9 +6,6 @@ const log = require('../shared/log')
|
|
|
6
6
|
const {defaultAlias} = require('../shared/resolve-alias')
|
|
7
7
|
const createSassLinkImporter = require('./sassLinkImporter.js')
|
|
8
8
|
|
|
9
|
-
const useExperimentalSCSSLoader =
|
|
10
|
-
config.optimizations && config.optimizations.useExperimentalSCSSLoader
|
|
11
|
-
|
|
12
9
|
const diccFromAbsolutePaths = (paths, init = {}) =>
|
|
13
10
|
paths.reduce((acc, pkg) => {
|
|
14
11
|
const packagePath = path.resolve(pkg)
|
|
@@ -64,14 +61,12 @@ module.exports = ({config, packagesToLink, linkAll}) => {
|
|
|
64
61
|
}
|
|
65
62
|
|
|
66
63
|
/**
|
|
67
|
-
* Create a sass-loader config for scss files that
|
|
64
|
+
* Create a @s-ui/sass-loader config for scss files that
|
|
68
65
|
* are handled by Sass. These are nested modules imported
|
|
69
66
|
* and thus is sass binary which needs a special config for them.
|
|
70
67
|
*/
|
|
71
68
|
const sassLoaderWithLinkImporter = {
|
|
72
|
-
loader:
|
|
73
|
-
? require.resolve('super-sass-loader')
|
|
74
|
-
: require.resolve('sass-loader'),
|
|
69
|
+
loader: require.resolve('@s-ui/sass-loader'),
|
|
75
70
|
options: {
|
|
76
71
|
sassOptions: {
|
|
77
72
|
importer: createSassLinkImporter(entryPoints)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s-ui/bundler",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0-beta.1",
|
|
4
4
|
"description": "Config-free bundler for ES6 React apps.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sui-bundler": "./bin/sui-bundler.js"
|
|
@@ -23,24 +23,24 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@babel/core": "7.16.0",
|
|
25
25
|
"@s-ui/helpers": "1",
|
|
26
|
+
"@s-ui/sass-loader": "1",
|
|
26
27
|
"autoprefixer": "10.4.0",
|
|
27
28
|
"babel-loader": "8.2.3",
|
|
28
29
|
"babel-preset-sui": "3",
|
|
29
30
|
"commander": "6.2.1",
|
|
30
|
-
"css-loader": "6.5.
|
|
31
|
+
"css-loader": "6.5.1",
|
|
31
32
|
"css-minimizer-webpack-plugin": "3.1.1",
|
|
32
33
|
"esbuild-loader": "2.16.0",
|
|
33
34
|
"fast-glob": "3.2.7",
|
|
34
35
|
"html-webpack-plugin": "5.5.0",
|
|
35
|
-
"mini-css-extract-plugin": "2.4.
|
|
36
|
+
"mini-css-extract-plugin": "2.4.4",
|
|
36
37
|
"null-loader": "4.0.1",
|
|
38
|
+
"process": "0.11.10",
|
|
37
39
|
"postcss": "8.3.11",
|
|
38
40
|
"postcss-loader": "6.2.0",
|
|
39
41
|
"react-dev-utils": "11.0.4",
|
|
40
42
|
"rimraf": "3.0.2",
|
|
41
43
|
"sass": "1.43.4",
|
|
42
|
-
"sass-loader": "12.3.0",
|
|
43
|
-
"super-sass-loader": "0.1",
|
|
44
44
|
"speed-measure-webpack-plugin": "1.5.0",
|
|
45
45
|
"style-loader": "3.3.1",
|
|
46
46
|
"terser-webpack-plugin": "5.2.4",
|
package/shared/config.js
CHANGED
|
@@ -10,4 +10,4 @@ exports.config = config
|
|
|
10
10
|
exports.useExperimentalMinifier =
|
|
11
11
|
config.optimizations && config.optimizations.useExperimentalMinifier
|
|
12
12
|
exports.extractComments = extractComments || false
|
|
13
|
-
exports.sourceMap = (sourcemaps && sourcemaps.prod) ||
|
|
13
|
+
exports.sourceMap = (sourcemaps && sourcemaps.prod) || false
|
package/webpack.config.dev.js
CHANGED
|
@@ -4,6 +4,7 @@ const path = require('path')
|
|
|
4
4
|
const webpack = require('webpack')
|
|
5
5
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
6
6
|
const SpeedMeasurePlugin = require('speed-measure-webpack-plugin')
|
|
7
|
+
|
|
7
8
|
const definePlugin = require('./shared/define')
|
|
8
9
|
const manifestLoaderRules = require('./shared/module-rules-manifest-loader')
|
|
9
10
|
const {aliasFromConfig, defaultAlias} = require('./shared/resolve-alias')
|
|
@@ -11,10 +12,11 @@ const {envVars, MAIN_ENTRY_POINT, config, cleanList, when} = require('./shared')
|
|
|
11
12
|
const {resolveLoader} = require('./shared/resolve-loader')
|
|
12
13
|
|
|
13
14
|
const EXCLUDED_FOLDERS_REGEXP = new RegExp(
|
|
14
|
-
`node_modules(?!${path.sep}@s-ui(${path.sep}
|
|
15
|
+
`node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)`
|
|
15
16
|
)
|
|
16
|
-
const
|
|
17
|
-
|
|
17
|
+
const outputPath = path.join(process.cwd(), 'dist')
|
|
18
|
+
|
|
19
|
+
process.env.NODE_ENV = 'development'
|
|
18
20
|
|
|
19
21
|
const smp = new SpeedMeasurePlugin()
|
|
20
22
|
|
|
@@ -29,8 +31,11 @@ const webpackConfig = {
|
|
|
29
31
|
...defaultAlias,
|
|
30
32
|
...aliasFromConfig
|
|
31
33
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
fallback: {
|
|
35
|
+
fs: false
|
|
36
|
+
},
|
|
37
|
+
modules: ['node_modules', path.resolve(process.cwd())],
|
|
38
|
+
extensions: ['.js', '.json']
|
|
34
39
|
},
|
|
35
40
|
stats: 'errors-only',
|
|
36
41
|
entry: cleanList([
|
|
@@ -38,19 +43,22 @@ const webpackConfig = {
|
|
|
38
43
|
MAIN_ENTRY_POINT
|
|
39
44
|
]),
|
|
40
45
|
target: 'web',
|
|
41
|
-
node: {fs: 'empty'},
|
|
42
46
|
optimization: {
|
|
43
|
-
|
|
47
|
+
emitOnErrors: false,
|
|
44
48
|
removeAvailableModules: false,
|
|
45
49
|
removeEmptyChunks: false,
|
|
46
50
|
runtimeChunk: true,
|
|
47
51
|
splitChunks: false
|
|
48
52
|
},
|
|
49
53
|
output: {
|
|
54
|
+
path: outputPath,
|
|
50
55
|
pathinfo: false,
|
|
51
56
|
publicPath: '/'
|
|
52
57
|
},
|
|
53
58
|
plugins: [
|
|
59
|
+
new webpack.ProvidePlugin({
|
|
60
|
+
process: 'process/browser'
|
|
61
|
+
}),
|
|
54
62
|
new webpack.EnvironmentPlugin(envVars(config.env)),
|
|
55
63
|
definePlugin({__DEV__: true}),
|
|
56
64
|
new HtmlWebpackPlugin({
|
|
@@ -99,9 +107,7 @@ const webpackConfig = {
|
|
|
99
107
|
}
|
|
100
108
|
}
|
|
101
109
|
},
|
|
102
|
-
|
|
103
|
-
? require.resolve('super-sass-loader')
|
|
104
|
-
: require.resolve('sass-loader')
|
|
110
|
+
require.resolve('@s-ui/sass-loader')
|
|
105
111
|
])
|
|
106
112
|
},
|
|
107
113
|
when(config['externals-manifest'], () =>
|
|
@@ -109,8 +115,9 @@ const webpackConfig = {
|
|
|
109
115
|
)
|
|
110
116
|
])
|
|
111
117
|
},
|
|
118
|
+
watch: true,
|
|
112
119
|
devtool:
|
|
113
|
-
config.sourcemaps && config.sourcemaps.dev ? config.sourcemaps.dev :
|
|
120
|
+
config.sourcemaps && config.sourcemaps.dev ? config.sourcemaps.dev : false
|
|
114
121
|
}
|
|
115
122
|
|
|
116
123
|
module.exports = config.measure ? smp.wrap(webpackConfig) : webpackConfig
|
package/webpack.config.prod.js
CHANGED
|
@@ -53,13 +53,7 @@ const webpackConfig = {
|
|
|
53
53
|
extensions: ['.js', '.json'],
|
|
54
54
|
modules: ['node_modules', path.resolve(process.cwd())]
|
|
55
55
|
},
|
|
56
|
-
entry:
|
|
57
|
-
? {
|
|
58
|
-
app: MAIN_ENTRY_POINT,
|
|
59
|
-
vendor: config.vendor
|
|
60
|
-
}
|
|
61
|
-
: MAIN_ENTRY_POINT,
|
|
62
|
-
target: 'web',
|
|
56
|
+
entry: MAIN_ENTRY_POINT,
|
|
63
57
|
output: {
|
|
64
58
|
chunkFilename: filename,
|
|
65
59
|
filename,
|
|
@@ -75,7 +69,7 @@ const webpackConfig = {
|
|
|
75
69
|
runtimeChunk: true
|
|
76
70
|
},
|
|
77
71
|
plugins: cleanList([
|
|
78
|
-
new webpack.HashedModuleIdsPlugin(),
|
|
72
|
+
new webpack.ids.HashedModuleIdsPlugin(),
|
|
79
73
|
new webpack.EnvironmentPlugin(envVars(config.env)),
|
|
80
74
|
definePlugin(),
|
|
81
75
|
new MiniCssExtractPlugin({
|
|
@@ -127,7 +121,7 @@ const webpackConfig = {
|
|
|
127
121
|
}
|
|
128
122
|
}
|
|
129
123
|
},
|
|
130
|
-
require.resolve('sass-loader')
|
|
124
|
+
require.resolve('@s-ui/sass-loader')
|
|
131
125
|
])
|
|
132
126
|
},
|
|
133
127
|
when(config['externals-manifest'], () =>
|
|
@@ -135,12 +129,7 @@ const webpackConfig = {
|
|
|
135
129
|
)
|
|
136
130
|
])
|
|
137
131
|
},
|
|
138
|
-
resolveLoader
|
|
139
|
-
node: {
|
|
140
|
-
fs: 'empty',
|
|
141
|
-
net: 'empty',
|
|
142
|
-
tls: 'empty'
|
|
143
|
-
}
|
|
132
|
+
resolveLoader
|
|
144
133
|
}
|
|
145
134
|
|
|
146
135
|
module.exports = config.measure ? smp.wrap(webpackConfig) : webpackConfig
|