swico 2.0.0-beta.34 → 2.0.0-beta.36
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 +1 -2
- package/src/config/rspack.prod.js +9 -10
- package/src/utils/tools.js +1 -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.36",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -54,7 +54,6 @@
|
|
|
54
54
|
"sass-embedded": "1.86.3",
|
|
55
55
|
"sass-loader": "16.0.5",
|
|
56
56
|
"style-loader": "3.3.0",
|
|
57
|
-
"terser-webpack-plugin": "5.3.14",
|
|
58
57
|
"ts-checker-rspack-plugin": "1.1.1",
|
|
59
58
|
"ts-node": "10.9.1",
|
|
60
59
|
"vue-loader": "17.4.2",
|
|
@@ -52,7 +52,6 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
52
52
|
const config_1 = require("../utils/config");
|
|
53
53
|
const webpack_merge_1 = require("webpack-merge");
|
|
54
54
|
const core_1 = require("@rspack/core");
|
|
55
|
-
const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
|
|
56
55
|
const BundleAnalyzerPlugin = webpack_bundle_analyzer_1.default.BundleAnalyzerPlugin;
|
|
57
56
|
const isAnalyze = process.env.ANALYZE === 'true';
|
|
58
57
|
function default_1(options) {
|
|
@@ -65,7 +64,6 @@ function default_1(options) {
|
|
|
65
64
|
const isPublicDirExist = yield fs_extra_1.default.exists(path_1.default.join(projectPath, '/public'));
|
|
66
65
|
const copyConfig = (_d = (_c = customConfig.prod) === null || _c === void 0 ? void 0 : _c.copy) !== null && _d !== void 0 ? _d : config_1.initConfig.copy;
|
|
67
66
|
const customDevtool = (_e = customConfig.prod.devtool) !== null && _e !== void 0 ? _e : customConfig.base.devtool;
|
|
68
|
-
console.log('consoleAvailable', consoleAvailable);
|
|
69
67
|
return (0, webpack_merge_1.merge)(baseConfig, {
|
|
70
68
|
output: {
|
|
71
69
|
cssFilename: 'css/[name].[contenthash].css',
|
|
@@ -80,15 +78,16 @@ function default_1(options) {
|
|
|
80
78
|
runtimeChunk: true,
|
|
81
79
|
minimize: true,
|
|
82
80
|
minimizer: [
|
|
83
|
-
new core_1.rspack.SwcJsMinimizerRspackPlugin({
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
minify: terser_webpack_plugin_1.default.swcMinify,
|
|
88
|
-
terserOptions: {
|
|
81
|
+
new core_1.rspack.SwcJsMinimizerRspackPlugin({
|
|
82
|
+
minimizerOptions: {
|
|
83
|
+
minify: true,
|
|
84
|
+
mangle: true,
|
|
89
85
|
compress: {
|
|
90
|
-
|
|
91
|
-
|
|
86
|
+
passes: 2,
|
|
87
|
+
drop_console: !consoleAvailable
|
|
88
|
+
},
|
|
89
|
+
format: {
|
|
90
|
+
comments: false
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
})
|
package/src/utils/tools.js
CHANGED
|
@@ -191,7 +191,6 @@ const initIndexFile = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
191
191
|
.replaceAll('\\', '/');
|
|
192
192
|
if (fileText.includes(`require("${formatHooksPath}");`)) {
|
|
193
193
|
fileText = fileText.replaceAll(`require("${formatHooksPath}");`, 'require("./project-path/.swico-react/react-hooks");');
|
|
194
|
-
yield fs_extra_1.default.writeFile(targetPath, fileText);
|
|
195
194
|
}
|
|
196
195
|
const formatDevHistoryPath = path_1.default
|
|
197
196
|
.resolve(projectPath, './.swico/.dev/history')
|
|
@@ -201,11 +200,10 @@ const initIndexFile = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
201
200
|
.replaceAll('\\', '/');
|
|
202
201
|
if (fileText.includes(`require("${formatDevHistoryPath}");`)) {
|
|
203
202
|
fileText = fileText.replaceAll(`require("${formatDevHistoryPath}");`, 'require("./mock-history");');
|
|
204
|
-
yield fs_extra_1.default.writeFile(targetPath, fileText);
|
|
205
203
|
}
|
|
206
204
|
else if (fileText.includes(`require("${formatProdHistoryPath}");`)) {
|
|
207
205
|
fileText = fileText.replaceAll(`require("${formatProdHistoryPath}");`, 'require("./mock-history");');
|
|
208
|
-
yield fs_extra_1.default.writeFile(targetPath, fileText);
|
|
209
206
|
}
|
|
207
|
+
yield fs_extra_1.default.writeFile(targetPath, fileText);
|
|
210
208
|
});
|
|
211
209
|
exports.initIndexFile = initIndexFile;
|