swico 2.6.0-beta.1 → 2.6.0-beta.3

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.6.0-beta.1",
3
+ "version": "2.6.0-beta.3",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -39,6 +39,7 @@
39
39
  "eslint-rspack-plugin": "4.2.1",
40
40
  "fs-extra": "11.3.0",
41
41
  "html-loader": "5.1.0",
42
+ "html-webpack-plugin": "5.6.4",
42
43
  "less": "4.3.0",
43
44
  "less-loader": "12.2.0",
44
45
  "ora": "5.4.1",
@@ -16,6 +16,7 @@ exports.default = default_1;
16
16
  const path_1 = __importDefault(require("path"));
17
17
  const main_config_1 = require("../main-config");
18
18
  const core_1 = require("@rspack/core");
19
+ const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
19
20
  const lessLoader = require.resolve('less-loader');
20
21
  const sassLoader = require.resolve('sass-loader');
21
22
  const postcssLoader = require.resolve('postcss-loader');
@@ -35,6 +36,12 @@ function default_1(_a) {
35
36
  };
36
37
  const publicPath = (_b = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath) !== null && _b !== void 0 ? _b : main_config_1.initConfig.publicPath;
37
38
  const routerBase = (_d = (_c = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.router) === null || _c === void 0 ? void 0 : _c.base) !== null && _d !== void 0 ? _d : main_config_1.initConfig.router.base;
39
+ const initialDefineVarsConfig = {
40
+ SWICO_ENV: JSON.stringify(env),
41
+ SWICO_ROUTER_BASE: JSON.stringify(routerBase),
42
+ SWICO_PUBLIC_PATH: JSON.stringify(publicPath)
43
+ };
44
+ const customDefineVarsConfig = yield (0, main_config_1.getFormatDefineVars)((_e = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.define) !== null && _e !== void 0 ? _e : {});
38
45
  return {
39
46
  entry: entryPath,
40
47
  output: {
@@ -143,18 +150,14 @@ function default_1(_a) {
143
150
  },
144
151
  externals: customConfig.base.externals,
145
152
  plugins: [
146
- new core_1.rspack.HtmlRspackPlugin({
153
+ new html_webpack_plugin_1.default({
147
154
  template: path_1.default.join(projectPath, '/src/index.ejs'),
148
155
  filename: 'index.html',
149
156
  minify: true,
150
- templateParameters: {
151
- SWICO_ENV: env,
152
- SWICO_ROUTER_BASE: routerBase,
153
- SWICO_PUBLIC_PATH: publicPath
154
- },
157
+ templateParameters: initialDefineVarsConfig,
155
158
  hash: true
156
159
  }),
157
- new core_1.rspack.DefinePlugin(Object.assign({ SWICO_ENV: env, SWICO_ROUTER_BASE: routerBase, SWICO_PUBLIC_PATH: publicPath }, (0, main_config_1.getFormatDefineVars)((_e = customConfig.base.define) !== null && _e !== void 0 ? _e : {}))),
160
+ new core_1.rspack.DefinePlugin(Object.assign(Object.assign({}, initialDefineVarsConfig), customDefineVarsConfig)),
158
161
  ...((_f = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) !== null && _f !== void 0 ? _f : main_config_1.initConfig.plugins)
159
162
  ]
160
163
  };
@@ -17,6 +17,7 @@ const path_1 = __importDefault(require("path"));
17
17
  const main_config_1 = require("../main-config");
18
18
  const vue_loader_1 = require("vue-loader");
19
19
  const core_1 = require("@rspack/core");
20
+ const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
20
21
  const vueStyleLoader = require.resolve('vue-style-loader');
21
22
  const cssLoader = require.resolve('css-loader');
22
23
  const lessLoader = require.resolve('less-loader');
@@ -38,6 +39,12 @@ function default_1(_a) {
38
39
  };
39
40
  const publicPath = (_b = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath) !== null && _b !== void 0 ? _b : main_config_1.initConfig.publicPath;
40
41
  const routerBase = (_d = (_c = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.router) === null || _c === void 0 ? void 0 : _c.base) !== null && _d !== void 0 ? _d : main_config_1.initConfig.router.base;
42
+ const initialDefineVarsConfig = {
43
+ SWICO_ENV: JSON.stringify(env),
44
+ SWICO_ROUTER_BASE: JSON.stringify(routerBase),
45
+ SWICO_PUBLIC_PATH: JSON.stringify(publicPath)
46
+ };
47
+ const customDefineVarsConfig = yield (0, main_config_1.getFormatDefineVars)((_e = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.define) !== null && _e !== void 0 ? _e : {});
41
48
  return {
42
49
  entry: entryPath,
43
50
  output: {
@@ -256,16 +263,12 @@ function default_1(_a) {
256
263
  ignoreOrder: true
257
264
  }),
258
265
  new vue_loader_1.VueLoaderPlugin(),
259
- new core_1.DefinePlugin(Object.assign({ __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false, __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false, SWICO_ENV: env, SWICO_ROUTER_BASE: routerBase, SWICO_PUBLIC_PATH: publicPath }, (0, main_config_1.getFormatDefineVars)((_e = customConfig.base.define) !== null && _e !== void 0 ? _e : {}))),
260
- new core_1.HtmlRspackPlugin({
266
+ new core_1.DefinePlugin(Object.assign(Object.assign({ __VUE_OPTIONS_API__: true, __VUE_PROD_DEVTOOLS__: false, __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false }, initialDefineVarsConfig), customDefineVarsConfig)),
267
+ new html_webpack_plugin_1.default({
261
268
  template: path_1.default.join(projectPath, '/src/index.ejs'),
262
269
  filename: 'index.html',
263
270
  minify: true,
264
- templateParameters: {
265
- SWICO_ENV: env,
266
- SWICO_ROUTER_BASE: routerBase,
267
- SWICO_PUBLIC_PATH: publicPath
268
- },
271
+ templateParameters: initialDefineVarsConfig,
269
272
  hash: true
270
273
  }),
271
274
  ...((_f = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) !== null && _f !== void 0 ? _f : main_config_1.initConfig.plugins)