swico 2.0.0-beta.29 → 2.0.0-beta.30

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,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "2.0.0-beta.29",
3
+ "version": "2.0.0-beta.30",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -40,6 +40,7 @@
40
40
  "commander": "12.0.0",
41
41
  "cross-spawn": "7.0.5",
42
42
  "css-loader": "7.1.2",
43
+ "esbuild-loader": "4.3.0",
43
44
  "eslint-rspack-plugin": "4.2.1",
44
45
  "fs-extra": "11.3.0",
45
46
  "html-loader": "5.1.0",
@@ -258,7 +258,10 @@ function default_1(_a) {
258
258
  externals: customConfig.base.externals,
259
259
  plugins: [
260
260
  ...basicPlugins,
261
- new core_1.CssExtractRspackPlugin({}),
261
+ new core_1.CssExtractRspackPlugin({
262
+ filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
263
+ ignoreOrder: true
264
+ }),
262
265
  new vue_loader_1.VueLoaderPlugin(),
263
266
  new core_1.DefinePlugin({
264
267
  __VUE_OPTIONS_API__: true,
@@ -54,17 +54,19 @@ const webpack_merge_1 = require("webpack-merge");
54
54
  const webpackbar_1 = __importDefault(require("webpackbar"));
55
55
  const tools_1 = require("../utils/tools");
56
56
  const core_1 = require("@rspack/core");
57
+ const esbuild_loader_1 = require("esbuild-loader");
57
58
  const BundleAnalyzerPlugin = webpack_bundle_analyzer_1.default.BundleAnalyzerPlugin;
58
59
  const isAnalyze = process.env.ANALYZE === 'true';
59
60
  function default_1(options) {
60
61
  return __awaiter(this, void 0, void 0, function* () {
61
- var _a, _b, _c, _d, _e;
62
+ var _a, _b, _c, _d, _e, _f, _g;
62
63
  const { projectPath, customConfig, templateType } = options;
63
64
  const getBaseConfig = (yield Promise.resolve(`${templateType === 'vue' ? './rspack.base.vue' : './rspack.base.react'}`).then(s => __importStar(require(s)))).default;
64
65
  const baseConfig = yield getBaseConfig(Object.assign(Object.assign({}, options), { env: 'prod' }));
66
+ const consoleAvailable = (_b = (_a = customConfig.prod) === null || _a === void 0 ? void 0 : _a.console) !== null && _b !== void 0 ? _b : config_1.initConfig.console;
65
67
  const isPublicDirExist = yield fs_extra_1.default.exists(path_1.default.join(projectPath, '/public'));
66
- const copyConfig = (_b = (_a = customConfig.prod) === null || _a === void 0 ? void 0 : _a.copy) !== null && _b !== void 0 ? _b : config_1.initConfig.copy;
67
- const customDevtool = (_c = customConfig.prod.devtool) !== null && _c !== void 0 ? _c : customConfig.base.devtool;
68
+ const copyConfig = (_d = (_c = customConfig.prod) === null || _c === void 0 ? void 0 : _c.copy) !== null && _d !== void 0 ? _d : config_1.initConfig.copy;
69
+ const customDevtool = (_e = customConfig.prod.devtool) !== null && _e !== void 0 ? _e : customConfig.base.devtool;
68
70
  return (0, webpack_merge_1.merge)(baseConfig, {
69
71
  output: {
70
72
  cssFilename: 'css/[name].[contenthash].css',
@@ -78,6 +80,14 @@ function default_1(options) {
78
80
  optimization: {
79
81
  runtimeChunk: true,
80
82
  minimize: true,
83
+ minimizer: [
84
+ new esbuild_loader_1.EsbuildPlugin({
85
+ target: 'es2015',
86
+ css: true,
87
+ minify: true,
88
+ drop: [...(!consoleAvailable ? ['console'] : []), 'debugger']
89
+ })
90
+ ],
81
91
  splitChunks: {
82
92
  chunks: 'all',
83
93
  cacheGroups: {
@@ -129,7 +139,7 @@ function default_1(options) {
129
139
  color: tools_1.colorConfig.theme,
130
140
  profile: false
131
141
  }),
132
- ...((_e = (_d = customConfig.prod) === null || _d === void 0 ? void 0 : _d.plugins) !== null && _e !== void 0 ? _e : [])
142
+ ...((_g = (_f = customConfig.prod) === null || _f === void 0 ? void 0 : _f.plugins) !== null && _g !== void 0 ? _g : [])
133
143
  ]
134
144
  });
135
145
  });