@s-ui/bundler 9.7.0 → 9.7.1-beta.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.
- package/README.md +1 -7
- package/package.json +2 -4
- package/shared/config.js +7 -2
- package/shared/minify-css.js +2 -6
- package/shared/minify-js.js +18 -1
- package/webpack.config.dev.js +0 -12
- package/webpack.config.prod.js +8 -14
package/README.md
CHANGED
|
@@ -163,6 +163,7 @@ This tool works with zero configuration out the box but you could use some confi
|
|
|
163
163
|
{
|
|
164
164
|
"config": {
|
|
165
165
|
"sui-bundler": {
|
|
166
|
+
"supportLegacyBrowsers": false, // default
|
|
166
167
|
"onlyHash": "true",
|
|
167
168
|
"env": ["APP_NAME", ["USER", "DEFAULT_VALUE"]],
|
|
168
169
|
"vendor": ["react", "react-dom"],
|
|
@@ -172,13 +173,6 @@ This tool works with zero configuration out the box but you could use some confi
|
|
|
172
173
|
"react": "preact"
|
|
173
174
|
},
|
|
174
175
|
"offline": true,
|
|
175
|
-
"targets": {
|
|
176
|
-
"chrome": "41",
|
|
177
|
-
"ie": "11",
|
|
178
|
-
"safari": "8",
|
|
179
|
-
"firefox": "60",
|
|
180
|
-
"ios": "8"
|
|
181
|
-
},
|
|
182
176
|
"sourcemaps": {
|
|
183
177
|
"dev": "cheap-module-eval-source-map",
|
|
184
178
|
"prod": "hidden-source-map"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s-ui/bundler",
|
|
3
|
-
"version": "9.7.0",
|
|
3
|
+
"version": "9.7.1-beta.0",
|
|
4
4
|
"description": "Config-free bundler for ES6 React apps.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sui-bundler": "./bin/sui-bundler.js"
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"@s-ui/helpers": "1",
|
|
26
26
|
"@s-ui/sass-loader": "1",
|
|
27
27
|
"address": "1.1.2",
|
|
28
|
-
"autoprefixer": "10.4.2",
|
|
29
28
|
"babel-loader": "8.2.3",
|
|
30
29
|
"babel-preset-sui": "3",
|
|
31
30
|
"buffer": "6.0.3",
|
|
@@ -39,8 +38,7 @@
|
|
|
39
38
|
"html-webpack-plugin": "5.5.0",
|
|
40
39
|
"https-browserify": "1.0.0",
|
|
41
40
|
"mini-css-extract-plugin": "2.5.3",
|
|
42
|
-
"
|
|
43
|
-
"postcss-loader": "6.2.1",
|
|
41
|
+
"@parcel/css": "1.3.1",
|
|
44
42
|
"process": "0.11.10",
|
|
45
43
|
"rimraf": "3.0.2",
|
|
46
44
|
"sass": "1.49.7",
|
package/shared/config.js
CHANGED
|
@@ -4,8 +4,13 @@ const {
|
|
|
4
4
|
} = require(`${process.cwd()}/package.json`)
|
|
5
5
|
|
|
6
6
|
const {'sui-bundler': config = {}} = packageJsonConfig
|
|
7
|
-
const {
|
|
7
|
+
const {
|
|
8
|
+
extractComments = false,
|
|
9
|
+
sourcemaps,
|
|
10
|
+
supportLegacyBrowsers = false
|
|
11
|
+
} = config
|
|
8
12
|
|
|
9
13
|
exports.config = config
|
|
10
|
-
exports.
|
|
14
|
+
exports.supportLegacyBrowsers = supportLegacyBrowsers
|
|
15
|
+
exports.extractComments = extractComments
|
|
11
16
|
exports.sourceMap = (sourcemaps && sourcemaps.prod) || false
|
package/shared/minify-css.js
CHANGED
|
@@ -2,13 +2,9 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
|
2
2
|
|
|
3
3
|
const createCssMinimizerPlugin = () =>
|
|
4
4
|
new CssMinimizerPlugin({
|
|
5
|
+
minify: CssMinimizerPlugin.parcelCssMinify,
|
|
5
6
|
minimizerOptions: {
|
|
6
|
-
|
|
7
|
-
'default',
|
|
8
|
-
{
|
|
9
|
-
discardComments: {removeAll: true}
|
|
10
|
-
}
|
|
11
|
-
]
|
|
7
|
+
targets: {ie: 11}
|
|
12
8
|
}
|
|
13
9
|
})
|
|
14
10
|
|
package/shared/minify-js.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const TerserPlugin = require('terser-webpack-plugin')
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const {supportLegacyBrowsers} = require('./config.js')
|
|
4
|
+
|
|
5
|
+
const esbuildMinifier = ({sourceMap}) =>
|
|
4
6
|
new TerserPlugin({
|
|
5
7
|
minify: TerserPlugin.esbuildMinify,
|
|
6
8
|
terserOptions: {
|
|
@@ -8,3 +10,18 @@ module.exports = ({extractComments, sourceMap}) =>
|
|
|
8
10
|
sourcemap: sourceMap !== 'none' && sourceMap !== false
|
|
9
11
|
}
|
|
10
12
|
})
|
|
13
|
+
|
|
14
|
+
const terserMinifier = ({extractComments, sourceMap}) =>
|
|
15
|
+
new TerserPlugin({
|
|
16
|
+
minify: TerserPlugin.esbuildMinify,
|
|
17
|
+
extractComments,
|
|
18
|
+
terserOptions: {
|
|
19
|
+
ecma: 5,
|
|
20
|
+
sourcemap: sourceMap !== 'none' && sourceMap !== false
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
module.exports = ({extractComments, sourceMap}) =>
|
|
25
|
+
supportLegacyBrowsers
|
|
26
|
+
? terserMinifier({extractComments, sourceMap})
|
|
27
|
+
: esbuildMinifier({sourceMap})
|
package/webpack.config.dev.js
CHANGED
|
@@ -106,18 +106,6 @@ const webpackConfig = {
|
|
|
106
106
|
}
|
|
107
107
|
})),
|
|
108
108
|
require.resolve('css-loader'),
|
|
109
|
-
{
|
|
110
|
-
loader: require.resolve('postcss-loader'),
|
|
111
|
-
options: {
|
|
112
|
-
postcssOptions: {
|
|
113
|
-
plugins: [
|
|
114
|
-
require('autoprefixer')({
|
|
115
|
-
overrideBrowserslist: config.targets
|
|
116
|
-
})
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
109
|
require.resolve('@s-ui/sass-loader')
|
|
122
110
|
])
|
|
123
111
|
},
|
package/webpack.config.prod.js
CHANGED
|
@@ -17,7 +17,11 @@ const {
|
|
|
17
17
|
config
|
|
18
18
|
} = require('./shared/index.js')
|
|
19
19
|
const {aliasFromConfig} = require('./shared/resolve-alias.js')
|
|
20
|
-
const {
|
|
20
|
+
const {
|
|
21
|
+
extractComments,
|
|
22
|
+
sourceMap,
|
|
23
|
+
supportLegacyBrowsers
|
|
24
|
+
} = require('./shared/config.js')
|
|
21
25
|
const {resolveLoader} = require('./shared/resolve-loader.js')
|
|
22
26
|
const babelRules = require('./shared/module-rules-babel.js')
|
|
23
27
|
const definePlugin = require('./shared/define.js')
|
|
@@ -35,13 +39,15 @@ const cssFileName = config.onlyHash
|
|
|
35
39
|
? '[contenthash:8].css'
|
|
36
40
|
: '[name].[contenthash:8].css'
|
|
37
41
|
|
|
42
|
+
const target = supportLegacyBrowsers ? ['web', 'es5'] : 'web'
|
|
43
|
+
|
|
38
44
|
/** @typedef {import('webpack').Configuration} WebpackConfig */
|
|
39
45
|
|
|
40
46
|
/** @type {WebpackConfig} */
|
|
41
47
|
const webpackConfig = {
|
|
42
48
|
devtool: sourceMap,
|
|
43
49
|
mode: 'production',
|
|
44
|
-
target
|
|
50
|
+
target,
|
|
45
51
|
context: path.resolve(process.cwd(), 'src'),
|
|
46
52
|
resolve: {
|
|
47
53
|
alias: {...aliasFromConfig},
|
|
@@ -117,18 +123,6 @@ const webpackConfig = {
|
|
|
117
123
|
manifestURL: config['externals-manifest']
|
|
118
124
|
}
|
|
119
125
|
})),
|
|
120
|
-
{
|
|
121
|
-
loader: require.resolve('postcss-loader'),
|
|
122
|
-
options: {
|
|
123
|
-
postcssOptions: {
|
|
124
|
-
plugins: [
|
|
125
|
-
require('autoprefixer')({
|
|
126
|
-
overrideBrowserslist: config.targets
|
|
127
|
-
})
|
|
128
|
-
]
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
126
|
require.resolve('@s-ui/sass-loader')
|
|
133
127
|
])
|
|
134
128
|
},
|