swico 2.0.0-beta.1 → 2.0.0-beta.10
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 +4 -9
- package/src/command/start.js +2 -2
- package/src/config/rsbpack.dev.js +2 -2
- package/src/config/rspack.base.react.d.ts +30 -3
- package/src/config/rspack.base.react.js +17 -15
- package/src/config/rspack.base.vue.d.ts +27 -39
- package/src/config/rspack.base.vue.js +21 -136
- package/src/config/rspack.prod.js +5 -6
- package/src/utils/tools.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swico",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"cli",
|
|
14
14
|
"swico",
|
|
15
15
|
"template",
|
|
16
|
-
"
|
|
16
|
+
"rspack"
|
|
17
17
|
],
|
|
18
18
|
"bin": {
|
|
19
19
|
"swico": "./src/bin.js"
|
|
@@ -30,10 +30,8 @@
|
|
|
30
30
|
"author": "scw",
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/types": "7.23.9",
|
|
34
33
|
"@rspack/core": "1.3.4",
|
|
35
34
|
"@rspack/dev-server": "^1.1.1",
|
|
36
|
-
"@swc/core": "1.4.6",
|
|
37
35
|
"@vue/compiler-sfc": "3.4.14",
|
|
38
36
|
"autoprefixer": "10.3.7",
|
|
39
37
|
"chalk": "4.1.2",
|
|
@@ -41,9 +39,6 @@
|
|
|
41
39
|
"commander": "12.0.0",
|
|
42
40
|
"cross-spawn": "7.0.5",
|
|
43
41
|
"css-loader": "6.3.0",
|
|
44
|
-
"eslint-plugin-react": "7.33.2",
|
|
45
|
-
"eslint-plugin-react-hooks": "4.3.0",
|
|
46
|
-
"eslint-plugin-vue": "9.19.2",
|
|
47
42
|
"eslint-webpack-plugin": "4.0.0",
|
|
48
43
|
"fs-extra": "11.3.0",
|
|
49
44
|
"html-loader": "5.0.0",
|
|
@@ -55,8 +50,8 @@
|
|
|
55
50
|
"postcss-preset-env": "9.3.0",
|
|
56
51
|
"qs": "6.13.0",
|
|
57
52
|
"react-router-dom": "6.23.0",
|
|
58
|
-
"sass": "1.
|
|
59
|
-
"sass-loader": "
|
|
53
|
+
"sass-embedded": "^1.86.3",
|
|
54
|
+
"sass-loader": "16.0.5",
|
|
60
55
|
"style-loader": "3.3.0",
|
|
61
56
|
"ts-checker-rspack-plugin": "^1.1.1",
|
|
62
57
|
"ts-node": "10.9.1",
|
package/src/command/start.js
CHANGED
|
@@ -35,7 +35,7 @@ const handleWatch = (projectPath, devServer, env) => {
|
|
|
35
35
|
ignored: [path_1.default.join(projectPath, '/config/swico.prod.ts')]
|
|
36
36
|
})
|
|
37
37
|
.on('all', (path, stats) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
-
tools_1.toast.warning('
|
|
38
|
+
tools_1.toast.warning('Configuration files changed, restarting server...', {
|
|
39
39
|
inline: true
|
|
40
40
|
});
|
|
41
41
|
yield devServer.stop();
|
|
@@ -119,7 +119,7 @@ const createCompileListener = (compiler) => {
|
|
|
119
119
|
const warnings = info.warnings;
|
|
120
120
|
warnings.some((item) => {
|
|
121
121
|
const msg = item.message || item.stack;
|
|
122
|
-
if (msg.
|
|
122
|
+
if (msg.includes('[eslint]')) {
|
|
123
123
|
tools_1.toast.warning(msg, { title: 'ESLint errors' });
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
@@ -65,9 +65,9 @@ function default_1(options) {
|
|
|
65
65
|
},
|
|
66
66
|
proxy: (_c = (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.dev) === null || _b === void 0 ? void 0 : _b.proxy) !== null && _c !== void 0 ? _c : config_1.initConfig.proxy,
|
|
67
67
|
compress: true,
|
|
68
|
-
hot:
|
|
68
|
+
hot: false,
|
|
69
69
|
open: false,
|
|
70
|
-
liveReload:
|
|
70
|
+
liveReload: true,
|
|
71
71
|
static: {
|
|
72
72
|
directory: path_1.default.join(projectPath, '/public')
|
|
73
73
|
},
|
|
@@ -4,6 +4,9 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
4
4
|
output: {
|
|
5
5
|
path: string;
|
|
6
6
|
filename: string;
|
|
7
|
+
chunkFilename: string;
|
|
8
|
+
cssFilename: string;
|
|
9
|
+
cssChunkFilename: string;
|
|
7
10
|
assetModuleFilename: string;
|
|
8
11
|
publicPath: string;
|
|
9
12
|
clean: boolean;
|
|
@@ -12,10 +15,12 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
12
15
|
css: boolean;
|
|
13
16
|
};
|
|
14
17
|
target: string[];
|
|
15
|
-
cache: {
|
|
16
|
-
type: string;
|
|
17
|
-
};
|
|
18
18
|
module: {
|
|
19
|
+
parser: {
|
|
20
|
+
'css/auto': {
|
|
21
|
+
namedExports: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
19
24
|
rules: ({
|
|
20
25
|
test: RegExp;
|
|
21
26
|
exclude: RegExp;
|
|
@@ -55,6 +60,28 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
55
60
|
})[];
|
|
56
61
|
generator?: undefined;
|
|
57
62
|
loader?: undefined;
|
|
63
|
+
} | {
|
|
64
|
+
test: RegExp;
|
|
65
|
+
type: string;
|
|
66
|
+
use: ({
|
|
67
|
+
loader: string;
|
|
68
|
+
options: {
|
|
69
|
+
postcssOptions: {
|
|
70
|
+
plugins: string[][];
|
|
71
|
+
};
|
|
72
|
+
api?: undefined;
|
|
73
|
+
implementation?: undefined;
|
|
74
|
+
};
|
|
75
|
+
} | {
|
|
76
|
+
loader: string;
|
|
77
|
+
options: {
|
|
78
|
+
api: string;
|
|
79
|
+
implementation: string;
|
|
80
|
+
postcssOptions?: undefined;
|
|
81
|
+
};
|
|
82
|
+
})[];
|
|
83
|
+
generator?: undefined;
|
|
84
|
+
loader?: undefined;
|
|
58
85
|
} | {
|
|
59
86
|
test: RegExp;
|
|
60
87
|
type: string;
|
|
@@ -46,6 +46,9 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
46
46
|
output: {
|
|
47
47
|
path: path_1.default.join(projectPath, '/dist'),
|
|
48
48
|
filename: 'js/[name].[chunkhash].js',
|
|
49
|
+
chunkFilename: 'js/[name].[chunkhash].js',
|
|
50
|
+
cssFilename: 'css/[name].[contenthash].css',
|
|
51
|
+
cssChunkFilename: 'css/[name].[contenthash].css',
|
|
49
52
|
assetModuleFilename: 'assets/[name]_[chunkhash][ext]',
|
|
50
53
|
publicPath,
|
|
51
54
|
clean: true
|
|
@@ -53,18 +56,20 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
53
56
|
experiments: {
|
|
54
57
|
css: true
|
|
55
58
|
},
|
|
56
|
-
target: ['web', '
|
|
57
|
-
cache: {
|
|
58
|
-
type: 'filesystem'
|
|
59
|
-
},
|
|
59
|
+
target: ['web', 'es2015'],
|
|
60
60
|
module: {
|
|
61
|
+
parser: {
|
|
62
|
+
'css/auto': {
|
|
63
|
+
namedExports: false
|
|
64
|
+
}
|
|
65
|
+
},
|
|
61
66
|
rules: [
|
|
62
67
|
{
|
|
63
68
|
test: /\.(tsx|ts|jsx)$/,
|
|
64
69
|
exclude: /node_modules/,
|
|
65
70
|
use: [
|
|
66
71
|
{
|
|
67
|
-
loader:
|
|
72
|
+
loader: 'builtin:swc-loader',
|
|
68
73
|
options: {
|
|
69
74
|
jsc: {
|
|
70
75
|
parser: {
|
|
@@ -92,7 +97,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
92
97
|
test: /\.css$/,
|
|
93
98
|
type: 'css/auto',
|
|
94
99
|
use: [
|
|
95
|
-
core_1.rspack.CssExtractRspackPlugin.loader,
|
|
96
100
|
cssLoader,
|
|
97
101
|
{
|
|
98
102
|
loader: postcssLoader,
|
|
@@ -108,8 +112,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
108
112
|
test: /\.less$/,
|
|
109
113
|
type: 'css/auto',
|
|
110
114
|
use: [
|
|
111
|
-
core_1.rspack.CssExtractRspackPlugin.loader,
|
|
112
|
-
cssLoader,
|
|
113
115
|
{
|
|
114
116
|
loader: postcssLoader,
|
|
115
117
|
options: {
|
|
@@ -125,8 +127,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
125
127
|
test: /\.scss$/,
|
|
126
128
|
type: 'css/auto',
|
|
127
129
|
use: [
|
|
128
|
-
core_1.rspack.CssExtractRspackPlugin.loader,
|
|
129
|
-
cssLoader,
|
|
130
130
|
{
|
|
131
131
|
loader: postcssLoader,
|
|
132
132
|
options: {
|
|
@@ -135,7 +135,13 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
|
-
|
|
138
|
+
{
|
|
139
|
+
loader: sassLoader,
|
|
140
|
+
options: {
|
|
141
|
+
api: 'modern-compiler',
|
|
142
|
+
implementation: require.resolve('sass-embedded')
|
|
143
|
+
}
|
|
144
|
+
}
|
|
139
145
|
]
|
|
140
146
|
},
|
|
141
147
|
{
|
|
@@ -181,10 +187,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
181
187
|
},
|
|
182
188
|
hash: true
|
|
183
189
|
}),
|
|
184
|
-
new core_1.rspack.CssExtractRspackPlugin({
|
|
185
|
-
filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
186
|
-
ignoreOrder: true
|
|
187
|
-
}),
|
|
188
190
|
...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins)
|
|
189
191
|
]
|
|
190
192
|
};
|
|
@@ -4,15 +4,23 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
4
4
|
output: {
|
|
5
5
|
path: string;
|
|
6
6
|
filename: string;
|
|
7
|
+
chunkFilename: string;
|
|
8
|
+
cssFilename: string;
|
|
9
|
+
cssChunkFilename: string;
|
|
7
10
|
assetModuleFilename: string;
|
|
8
11
|
publicPath: string;
|
|
9
12
|
clean: boolean;
|
|
10
13
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type: string;
|
|
14
|
+
experiments: {
|
|
15
|
+
css: boolean;
|
|
14
16
|
};
|
|
17
|
+
target: string[];
|
|
15
18
|
module: {
|
|
19
|
+
parser: {
|
|
20
|
+
'css/auto': {
|
|
21
|
+
namedExports: boolean;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
16
24
|
rules: ({
|
|
17
25
|
test: RegExp;
|
|
18
26
|
loader: string;
|
|
@@ -45,58 +53,38 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
45
53
|
} | {
|
|
46
54
|
oneOf: ({
|
|
47
55
|
test: RegExp;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
options: {
|
|
61
|
-
postcssOptions: {
|
|
62
|
-
plugins: string[][];
|
|
63
|
-
};
|
|
64
|
-
modules?: undefined;
|
|
65
|
-
};
|
|
66
|
-
})[];
|
|
67
|
-
} | {
|
|
68
|
-
use: (string | {
|
|
69
|
-
loader: string;
|
|
70
|
-
options: {
|
|
71
|
-
postcssOptions: {
|
|
72
|
-
plugins: string[][];
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
})[];
|
|
76
|
-
resourceQuery?: undefined;
|
|
77
|
-
})[];
|
|
78
|
-
type?: undefined;
|
|
56
|
+
type: string;
|
|
57
|
+
loader: string;
|
|
58
|
+
options?: undefined;
|
|
59
|
+
generator?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
test: RegExp;
|
|
62
|
+
type: string;
|
|
63
|
+
loader: string;
|
|
64
|
+
options: {
|
|
65
|
+
api: string;
|
|
66
|
+
implementation: string;
|
|
67
|
+
};
|
|
79
68
|
generator?: undefined;
|
|
80
|
-
loader?: undefined;
|
|
81
69
|
} | {
|
|
82
70
|
test: RegExp;
|
|
83
71
|
type: string;
|
|
84
72
|
generator: {
|
|
85
73
|
filename: string;
|
|
86
74
|
};
|
|
87
|
-
oneOf?: undefined;
|
|
88
75
|
loader?: undefined;
|
|
76
|
+
options?: undefined;
|
|
89
77
|
} | {
|
|
90
78
|
test: RegExp;
|
|
91
79
|
type: string;
|
|
92
|
-
oneOf?: undefined;
|
|
93
|
-
generator?: undefined;
|
|
94
80
|
loader?: undefined;
|
|
81
|
+
options?: undefined;
|
|
82
|
+
generator?: undefined;
|
|
95
83
|
} | {
|
|
96
84
|
test: RegExp;
|
|
97
85
|
loader: string;
|
|
98
|
-
oneOf?: undefined;
|
|
99
86
|
type?: undefined;
|
|
87
|
+
options?: undefined;
|
|
100
88
|
generator?: undefined;
|
|
101
89
|
})[];
|
|
102
90
|
test?: undefined;
|
|
@@ -48,15 +48,23 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
48
48
|
output: {
|
|
49
49
|
path: path_1.default.join(projectPath, '/dist'),
|
|
50
50
|
filename: 'js/[name].[chunkhash].js',
|
|
51
|
-
|
|
51
|
+
chunkFilename: 'js/[name].[chunkhash].js',
|
|
52
|
+
cssFilename: 'css/[name].[contenthash].css',
|
|
53
|
+
cssChunkFilename: 'css/[name].[contenthash].css',
|
|
54
|
+
assetModuleFilename: 'assets/[name]_[id][ext]',
|
|
52
55
|
publicPath,
|
|
53
56
|
clean: true
|
|
54
57
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type: 'filesystem'
|
|
58
|
+
experiments: {
|
|
59
|
+
css: true
|
|
58
60
|
},
|
|
61
|
+
target: ['web', 'es5'],
|
|
59
62
|
module: {
|
|
63
|
+
parser: {
|
|
64
|
+
'css/auto': {
|
|
65
|
+
namedExports: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
60
68
|
rules: [
|
|
61
69
|
{
|
|
62
70
|
test: /\.vue$/,
|
|
@@ -71,7 +79,7 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
71
79
|
exclude: /node_modules/,
|
|
72
80
|
use: [
|
|
73
81
|
{
|
|
74
|
-
loader:
|
|
82
|
+
loader: 'builtin:swc-loader',
|
|
75
83
|
options: {
|
|
76
84
|
jsc: {
|
|
77
85
|
parser: {
|
|
@@ -88,138 +96,19 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
88
96
|
},
|
|
89
97
|
{
|
|
90
98
|
oneOf: [
|
|
91
|
-
{
|
|
92
|
-
test: /\.css$/,
|
|
93
|
-
oneOf: [
|
|
94
|
-
{
|
|
95
|
-
resourceQuery: /module/,
|
|
96
|
-
use: [
|
|
97
|
-
vueStyleLoader,
|
|
98
|
-
{
|
|
99
|
-
loader: cssLoader,
|
|
100
|
-
options: {
|
|
101
|
-
modules: {
|
|
102
|
-
localIdentName: 'moduleStyle_[local]_[contenthash:8]'
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
loader: postcssLoader,
|
|
108
|
-
options: {
|
|
109
|
-
postcssOptions: {
|
|
110
|
-
plugins: [['autoprefixer']]
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
use: [
|
|
118
|
-
env === 'dev'
|
|
119
|
-
? vueStyleLoader
|
|
120
|
-
: core_1.CssExtractRspackPlugin.loader,
|
|
121
|
-
cssLoader,
|
|
122
|
-
{
|
|
123
|
-
loader: postcssLoader,
|
|
124
|
-
options: {
|
|
125
|
-
postcssOptions: {
|
|
126
|
-
plugins: [['autoprefixer']]
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
]
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
},
|
|
134
99
|
{
|
|
135
100
|
test: /\.less$/,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
resourceQuery: /module/,
|
|
139
|
-
use: [
|
|
140
|
-
vueStyleLoader,
|
|
141
|
-
{
|
|
142
|
-
loader: cssLoader,
|
|
143
|
-
options: {
|
|
144
|
-
modules: {
|
|
145
|
-
localIdentName: 'moduleStyle_[local]_[contenthash:8]'
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
loader: postcssLoader,
|
|
151
|
-
options: {
|
|
152
|
-
postcssOptions: {
|
|
153
|
-
plugins: [['autoprefixer']]
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
lessLoader
|
|
158
|
-
]
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
use: [
|
|
162
|
-
env === 'dev'
|
|
163
|
-
? vueStyleLoader
|
|
164
|
-
: core_1.CssExtractRspackPlugin.loader,
|
|
165
|
-
cssLoader,
|
|
166
|
-
{
|
|
167
|
-
loader: postcssLoader,
|
|
168
|
-
options: {
|
|
169
|
-
postcssOptions: {
|
|
170
|
-
plugins: [['autoprefixer']]
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
lessLoader
|
|
175
|
-
]
|
|
176
|
-
}
|
|
177
|
-
]
|
|
101
|
+
type: 'css',
|
|
102
|
+
loader: lessLoader
|
|
178
103
|
},
|
|
179
104
|
{
|
|
180
105
|
test: /\.scss$/,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
loader: cssLoader,
|
|
188
|
-
options: {
|
|
189
|
-
modules: {
|
|
190
|
-
localIdentName: 'moduleStyle_[local]_[contenthash:8]'
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
loader: postcssLoader,
|
|
196
|
-
options: {
|
|
197
|
-
postcssOptions: {
|
|
198
|
-
plugins: [['autoprefixer']]
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
sassLoader
|
|
203
|
-
]
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
use: [
|
|
207
|
-
env === 'dev'
|
|
208
|
-
? vueStyleLoader
|
|
209
|
-
: core_1.CssExtractRspackPlugin.loader,
|
|
210
|
-
cssLoader,
|
|
211
|
-
{
|
|
212
|
-
loader: postcssLoader,
|
|
213
|
-
options: {
|
|
214
|
-
postcssOptions: {
|
|
215
|
-
plugins: [['autoprefixer']]
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
sassLoader
|
|
220
|
-
]
|
|
221
|
-
}
|
|
222
|
-
]
|
|
106
|
+
type: 'css',
|
|
107
|
+
loader: sassLoader,
|
|
108
|
+
options: {
|
|
109
|
+
api: 'modern-compiler',
|
|
110
|
+
implementation: require.resolve('sass-embedded')
|
|
111
|
+
}
|
|
223
112
|
},
|
|
224
113
|
{
|
|
225
114
|
test: /\.(jpg|png|gif|webp|bmp|jpeg|svg)$/,
|
|
@@ -270,10 +159,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
270
159
|
},
|
|
271
160
|
hash: true
|
|
272
161
|
}),
|
|
273
|
-
new core_1.CssExtractRspackPlugin({
|
|
274
|
-
filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
275
|
-
ignoreOrder: true
|
|
276
|
-
}),
|
|
277
162
|
...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins)
|
|
278
163
|
]
|
|
279
164
|
};
|
|
@@ -46,15 +46,14 @@ const core_1 = require("@rspack/core");
|
|
|
46
46
|
const BundleAnalyzerPlugin = webpack_bundle_analyzer_1.default.BundleAnalyzerPlugin;
|
|
47
47
|
const isAnalyze = process.env.ANALYZE === 'true';
|
|
48
48
|
function default_1(options) {
|
|
49
|
-
var _a, _b, _c, _d, _e
|
|
49
|
+
var _a, _b, _c, _d, _e;
|
|
50
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
51
|
const { projectPath, customConfig, templateType } = options;
|
|
52
|
-
const getBaseConfig = (yield Promise.resolve(`${templateType === 'vue' ? './
|
|
52
|
+
const getBaseConfig = (yield Promise.resolve(`${templateType === 'vue' ? './rspack.base.vue' : './rspack.base.react'}`).then(s => __importStar(require(s)))).default;
|
|
53
53
|
const baseConfig = yield getBaseConfig(Object.assign(Object.assign({}, options), { env: 'prod' }));
|
|
54
|
-
const consoleAvailable = (_b = (_a = customConfig.prod) === null || _a === void 0 ? void 0 : _a.console) !== null && _b !== void 0 ? _b : config_1.initConfig.console;
|
|
55
54
|
const isPublicDirExist = yield fs_extra_1.default.exists(path_1.default.join(projectPath, '/public'));
|
|
56
|
-
const copyConfig = (
|
|
57
|
-
const customDevtool = (
|
|
55
|
+
const copyConfig = (_b = (_a = customConfig.prod) === null || _a === void 0 ? void 0 : _a.copy) !== null && _b !== void 0 ? _b : config_1.initConfig.copy;
|
|
56
|
+
const customDevtool = (_c = customConfig.prod.devtool) !== null && _c !== void 0 ? _c : customConfig.base.devtool;
|
|
58
57
|
return (0, webpack_merge_1.merge)(baseConfig, {
|
|
59
58
|
performance: {
|
|
60
59
|
hints: false
|
|
@@ -115,7 +114,7 @@ function default_1(options) {
|
|
|
115
114
|
color: tools_1.colorConfig.theme,
|
|
116
115
|
profile: false
|
|
117
116
|
}),
|
|
118
|
-
...((
|
|
117
|
+
...((_e = (_d = customConfig.prod) === null || _d === void 0 ? void 0 : _d.plugins) !== null && _e !== void 0 ? _e : [])
|
|
119
118
|
]
|
|
120
119
|
});
|
|
121
120
|
});
|
package/src/utils/tools.js
CHANGED
|
@@ -141,14 +141,14 @@ exports.toast = {
|
|
|
141
141
|
else {
|
|
142
142
|
if (Array.isArray(message)) {
|
|
143
143
|
if (message.length > 0) {
|
|
144
|
-
console.log(`${chalk_1.default.red.bold('error')} - ${title || '
|
|
144
|
+
console.log(`${chalk_1.default.red.bold('error')} - ${title || 'Swico errors'}:`);
|
|
145
145
|
}
|
|
146
146
|
message.forEach((item) => {
|
|
147
147
|
console.log(`> ${chalk_1.default.red.bold(item)}`);
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
else if (message) {
|
|
151
|
-
console.log(`${chalk_1.default.red.bold('error')} - ${title || '
|
|
151
|
+
console.log(`${chalk_1.default.red.bold('error')} - ${title || 'Swico errors'}:`);
|
|
152
152
|
console.log(`> ${chalk_1.default.red.bold(message)}`);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -160,7 +160,7 @@ exports.toast = {
|
|
|
160
160
|
console.log(`${chalk_1.default.hex(color).bold('warning')} - ${message}`);
|
|
161
161
|
}
|
|
162
162
|
else {
|
|
163
|
-
console.log(`${chalk_1.default.hex(color).bold('warning')} - ${title || '
|
|
163
|
+
console.log(`${chalk_1.default.hex(color).bold('warning')} - ${title || ' Swico warnings'}:`);
|
|
164
164
|
if (Array.isArray(message)) {
|
|
165
165
|
message.forEach((item) => {
|
|
166
166
|
console.log(`> ${chalk_1.default.hex(color).bold(item)}`);
|