@s-ui/bundler 9.31.0 → 9.32.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/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const path = require('path')
|
|
2
2
|
const {config} = require('./index.js')
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const EXCLUDED_FOLDERS_REGEXP = new RegExp(
|
|
5
|
+
`node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)`
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
module.exports = ({isServer = false, supportLegacyBrowsers = false} = {}) => ({
|
|
5
9
|
test: /\.jsx?$/,
|
|
6
|
-
exclude:
|
|
10
|
+
exclude: EXCLUDED_FOLDERS_REGEXP,
|
|
7
11
|
use: [
|
|
8
12
|
{
|
|
9
13
|
loader: require.resolve('babel-loader'),
|
|
@@ -16,6 +20,8 @@ module.exports = {
|
|
|
16
20
|
[
|
|
17
21
|
require.resolve('babel-preset-sui'),
|
|
18
22
|
{
|
|
23
|
+
isServer,
|
|
24
|
+
supportLegacyBrowsers,
|
|
19
25
|
targets: config.targets
|
|
20
26
|
}
|
|
21
27
|
]
|
|
@@ -23,4 +29,4 @@ module.exports = {
|
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
31
|
]
|
|
26
|
-
}
|
|
32
|
+
})
|
package/webpack.config.dev.js
CHANGED
|
@@ -16,13 +16,11 @@ const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
|
|
|
16
16
|
const {aliasFromConfig, defaultAlias} = require('./shared/resolve-alias.js')
|
|
17
17
|
|
|
18
18
|
const {resolveLoader} = require('./shared/resolve-loader.js')
|
|
19
|
+
const createBabelRules = require('./shared/module-rules-babel.js')
|
|
19
20
|
|
|
20
|
-
const EXCLUDED_FOLDERS_REGEXP = new RegExp(
|
|
21
|
-
`node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)`
|
|
22
|
-
)
|
|
23
21
|
const outputPath = path.join(process.cwd(), 'dist')
|
|
24
22
|
|
|
25
|
-
const {CI = false} = process.env
|
|
23
|
+
const {CI = false, PWD = ''} = process.env
|
|
26
24
|
|
|
27
25
|
process.env.NODE_ENV = 'development'
|
|
28
26
|
|
|
@@ -31,7 +29,7 @@ process.env.NODE_ENV = 'development'
|
|
|
31
29
|
/** @type {WebpackConfig} */
|
|
32
30
|
const webpackConfig = {
|
|
33
31
|
mode: 'development',
|
|
34
|
-
context: path.resolve(
|
|
32
|
+
context: path.resolve(PWD, 'src'),
|
|
35
33
|
resolve: {
|
|
36
34
|
alias: {
|
|
37
35
|
...defaultAlias,
|
|
@@ -81,20 +79,7 @@ const webpackConfig = {
|
|
|
81
79
|
resolveLoader,
|
|
82
80
|
module: {
|
|
83
81
|
rules: cleanList([
|
|
84
|
-
|
|
85
|
-
test: /\.jsx?$/,
|
|
86
|
-
exclude: EXCLUDED_FOLDERS_REGEXP,
|
|
87
|
-
use: [
|
|
88
|
-
{
|
|
89
|
-
loader: require.resolve('babel-loader'),
|
|
90
|
-
options: {
|
|
91
|
-
babelrc: false,
|
|
92
|
-
cacheDirectory: true,
|
|
93
|
-
presets: [require.resolve('babel-preset-sui')]
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
},
|
|
82
|
+
createBabelRules(),
|
|
98
83
|
{
|
|
99
84
|
test: /(\.css|\.scss)$/,
|
|
100
85
|
use: cleanList([
|
package/webpack.config.lib.js
CHANGED
|
@@ -9,7 +9,7 @@ const {
|
|
|
9
9
|
const path = require('path')
|
|
10
10
|
const minifyJs = require('./shared/minify-js.js')
|
|
11
11
|
const definePlugin = require('./shared/define.js')
|
|
12
|
-
const
|
|
12
|
+
const createBabelRules = require('./shared/module-rules-babel.js')
|
|
13
13
|
const sassRules = require('./shared/module-rules-sass.js')
|
|
14
14
|
const {extractComments, sourceMap} = require('./shared/config.js')
|
|
15
15
|
const {aliasFromConfig} = require('./shared/resolve-alias.js')
|
|
@@ -63,6 +63,6 @@ module.exports = {
|
|
|
63
63
|
definePlugin()
|
|
64
64
|
]),
|
|
65
65
|
module: {
|
|
66
|
-
rules: [
|
|
66
|
+
rules: [createBabelRules(), sassRules]
|
|
67
67
|
}
|
|
68
68
|
}
|
package/webpack.config.prod.js
CHANGED
|
@@ -23,14 +23,16 @@ const {
|
|
|
23
23
|
supportLegacyBrowsers
|
|
24
24
|
} = require('./shared/config.js')
|
|
25
25
|
const {resolveLoader} = require('./shared/resolve-loader.js')
|
|
26
|
-
const
|
|
26
|
+
const createBabelRules = require('./shared/module-rules-babel.js')
|
|
27
27
|
const sassRules = require('./shared/module-rules-sass.js')
|
|
28
28
|
const definePlugin = require('./shared/define.js')
|
|
29
29
|
const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
|
|
30
30
|
const minifyCss = require('./shared/minify-css.js')
|
|
31
31
|
const minifyJs = require('./shared/minify-js.js')
|
|
32
32
|
|
|
33
|
+
const CWD = process.cwd()
|
|
33
34
|
const PUBLIC_PATH = process.env.CDN || config.cdn || '/'
|
|
35
|
+
const PWD = process.env.PWD ?? ''
|
|
34
36
|
|
|
35
37
|
const filename = config.onlyHash
|
|
36
38
|
? '[contenthash:8].js'
|
|
@@ -49,11 +51,11 @@ const webpackConfig = {
|
|
|
49
51
|
devtool: sourceMap,
|
|
50
52
|
mode: 'production',
|
|
51
53
|
target,
|
|
52
|
-
context: path.resolve(
|
|
54
|
+
context: path.resolve(CWD, 'src'),
|
|
53
55
|
resolve: {
|
|
54
56
|
alias: {...aliasFromConfig},
|
|
55
57
|
extensions: ['.js', '.json'],
|
|
56
|
-
modules: ['node_modules', path.resolve(
|
|
58
|
+
modules: ['node_modules', path.resolve(CWD)],
|
|
57
59
|
fallback: {
|
|
58
60
|
assert: false,
|
|
59
61
|
fs: false,
|
|
@@ -66,7 +68,7 @@ const webpackConfig = {
|
|
|
66
68
|
output: {
|
|
67
69
|
chunkFilename: filename,
|
|
68
70
|
filename,
|
|
69
|
-
path: path.resolve(
|
|
71
|
+
path: path.resolve(PWD, 'public'),
|
|
70
72
|
publicPath: PUBLIC_PATH
|
|
71
73
|
},
|
|
72
74
|
optimization: {
|
|
@@ -109,7 +111,7 @@ const webpackConfig = {
|
|
|
109
111
|
]),
|
|
110
112
|
module: {
|
|
111
113
|
rules: cleanList([
|
|
112
|
-
|
|
114
|
+
createBabelRules({supportLegacyBrowsers}),
|
|
113
115
|
sassRules,
|
|
114
116
|
when(config['externals-manifest'], () =>
|
|
115
117
|
manifestLoaderRules(config['externals-manifest'])
|
package/webpack.config.server.js
CHANGED
|
@@ -3,7 +3,7 @@ const webpackNodeExternals = require('webpack-node-externals')
|
|
|
3
3
|
const path = require('path')
|
|
4
4
|
|
|
5
5
|
const {config, when, cleanList} = require('./shared/index.js')
|
|
6
|
-
const
|
|
6
|
+
const createBabelRules = require('./shared/module-rules-babel.js')
|
|
7
7
|
const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
|
|
8
8
|
const {aliasFromConfig} = require('./shared/resolve-alias.js')
|
|
9
9
|
const {resolveLoader} = require('./shared/resolve-loader.js')
|
|
@@ -39,7 +39,7 @@ const webpackConfig = {
|
|
|
39
39
|
resolveLoader,
|
|
40
40
|
module: {
|
|
41
41
|
rules: cleanList([
|
|
42
|
-
|
|
42
|
+
createBabelRules({isServer: true}),
|
|
43
43
|
{
|
|
44
44
|
// ignore css/scss/svg require/imports files in the server
|
|
45
45
|
test: /(\.svg|\.s?css)$/,
|