swico 1.7.3 → 2.0.0-beta.1

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.
Files changed (32) hide show
  1. package/package.json +7 -13
  2. package/src/bin.js +6 -6
  3. package/src/command/build.js +33 -73
  4. package/src/command/start.js +99 -191
  5. package/src/config/rsbpack.dev.js +104 -0
  6. package/src/config/{webpack.base.react.d.ts → rspack.base.react.d.ts} +13 -3
  7. package/src/config/rspack.base.react.js +193 -0
  8. package/src/config/{webpack.base.vue.d.ts → rspack.base.vue.d.ts} +13 -1
  9. package/src/config/rspack.base.vue.js +282 -0
  10. package/src/config/rspack.prod.js +123 -0
  11. package/src/index.js +3 -5
  12. package/src/index.react.js +5 -10
  13. package/src/index.vue.js +4 -6
  14. package/src/project-path/.swico-react/$env/history.js +65 -66
  15. package/src/project-path/.swico-react/$env/index.js +29 -47
  16. package/src/project-path/.swico-react/loading.js +1 -1
  17. package/src/project-path/.swico-react/react-hooks.js +24 -37
  18. package/src/project-path/.swico-vue/$env/history.js +25 -36
  19. package/src/project-path/.swico-vue/$env/index.js +7 -7
  20. package/src/project-path/.swico-vue/Container.js +1 -1
  21. package/src/project-path/.swico-vue/vue-hooks.js +17 -28
  22. package/src/project-path/src/layout/Layout.js +1 -1
  23. package/src/project-path/src/layout/index.js +3 -3
  24. package/src/task.js +13 -58
  25. package/src/utils/config.js +185 -349
  26. package/src/utils/tools.js +103 -199
  27. package/src/config/webpack.base.react.js +0 -315
  28. package/src/config/webpack.base.vue.js +0 -338
  29. package/src/config/webpack.dev.js +0 -159
  30. package/src/config/webpack.prod.js +0 -193
  31. /package/src/config/{webpack.dev.d.ts → rsbpack.dev.d.ts} +0 -0
  32. /package/src/config/{webpack.prod.d.ts → rspack.prod.d.ts} +0 -0
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const config_1 = require("../utils/config");
39
+ const path_1 = __importDefault(require("path"));
40
+ const webpack_merge_1 = require("webpack-merge");
41
+ const eslint_webpack_plugin_1 = __importDefault(require("eslint-webpack-plugin"));
42
+ const ts_checker_rspack_plugin_1 = require("ts-checker-rspack-plugin");
43
+ const tools_1 = require("../utils/tools");
44
+ function default_1(options) {
45
+ var _a, _b, _c, _d, _e;
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const { projectPath, customConfig, templateType, entryPath, env } = options;
48
+ const getBaseConfig = (yield Promise.resolve(`${templateType === 'vue' ? './rspack.base.vue' : './rspack.base.react'}`).then(s => __importStar(require(s)))).default;
49
+ const baseConfig = yield getBaseConfig(Object.assign(Object.assign({}, options), { env: 'dev' }));
50
+ const customDevtool = (_a = customConfig.dev.devtool) !== null && _a !== void 0 ? _a : customConfig.base.devtool;
51
+ return (0, webpack_merge_1.merge)(baseConfig, {
52
+ mode: 'development',
53
+ stats: 'none',
54
+ devtool: templateType === 'vue'
55
+ ? customDevtool !== null && customDevtool !== void 0 ? customDevtool : 'cheap-module-source-map'
56
+ : customDevtool !== null && customDevtool !== void 0 ? customDevtool : 'eval-cheap-module-source-map',
57
+ devServer: {
58
+ historyApiFallback: {
59
+ index: `${baseConfig.output.publicPath}index.html`
60
+ },
61
+ client: {
62
+ logging: 'error',
63
+ progress: false,
64
+ overlay: false
65
+ },
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
+ compress: true,
68
+ hot: true,
69
+ open: false,
70
+ liveReload: false,
71
+ static: {
72
+ directory: path_1.default.join(projectPath, '/public')
73
+ },
74
+ server: customConfig.dev.https === true ? 'https' : 'http'
75
+ },
76
+ plugins: [
77
+ new ts_checker_rspack_plugin_1.TsCheckerRspackPlugin({
78
+ logger: {
79
+ log: () => { },
80
+ error: (message) => {
81
+ tools_1.toast.error(message, { title: 'TypeScript errors' });
82
+ }
83
+ },
84
+ typescript: {
85
+ diagnosticOptions: {
86
+ semantic: true,
87
+ syntactic: true
88
+ }
89
+ }
90
+ }),
91
+ new eslint_webpack_plugin_1.default({
92
+ context: path_1.default.join(projectPath, '/src'),
93
+ failOnError: false,
94
+ failOnWarning: true,
95
+ extensions: templateType === 'vue' ? ['vue', 'ts', 'js'] : ['tsx', 'ts', 'js'],
96
+ emitWarning: false,
97
+ cache: true
98
+ }),
99
+ ...((_e = (_d = customConfig.dev) === null || _d === void 0 ? void 0 : _d.plugins) !== null && _e !== void 0 ? _e : [])
100
+ ]
101
+ });
102
+ });
103
+ }
104
+ exports.default = default_1;
@@ -8,6 +8,9 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
8
8
  publicPath: string;
9
9
  clean: boolean;
10
10
  };
11
+ experiments: {
12
+ css: boolean;
13
+ };
11
14
  target: string[];
12
15
  cache: {
13
16
  type: string;
@@ -41,8 +44,15 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
41
44
  } | {
42
45
  oneOf: ({
43
46
  test: RegExp;
44
- use: any[];
45
- type?: undefined;
47
+ type: string;
48
+ use: (string | {
49
+ loader: string;
50
+ options: {
51
+ postcssOptions: {
52
+ plugins: string[][];
53
+ };
54
+ };
55
+ })[];
46
56
  generator?: undefined;
47
57
  loader?: undefined;
48
58
  } | {
@@ -62,8 +72,8 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
62
72
  } | {
63
73
  test: RegExp;
64
74
  loader: string;
65
- use?: undefined;
66
75
  type?: undefined;
76
+ use?: undefined;
67
77
  generator?: undefined;
68
78
  })[];
69
79
  test?: undefined;
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const path_1 = __importDefault(require("path"));
16
+ const config_1 = require("../utils/config");
17
+ const core_1 = require("@rspack/core");
18
+ const cssLoader = require.resolve('css-loader');
19
+ const lessLoader = require.resolve('less-loader');
20
+ const sassLoader = require.resolve('sass-loader');
21
+ const postcssLoader = require.resolve('postcss-loader');
22
+ function default_1({ projectPath, entryPath, env, customConfig }) {
23
+ var _a, _b, _c;
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const customBaseConfig = customConfig.base;
26
+ const getCustomAliasConfig = () => {
27
+ const { alias } = customBaseConfig || {};
28
+ const custAliasConfig = {};
29
+ if (alias) {
30
+ Object.keys(alias).forEach((key) => {
31
+ custAliasConfig[key] = path_1.default.join(projectPath, `/${alias[key]}`);
32
+ });
33
+ }
34
+ return custAliasConfig;
35
+ };
36
+ const publicPath = (customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath) || config_1.initConfig.publicPath;
37
+ const routerBase = ((_a = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.router) === null || _a === void 0 ? void 0 : _a.base) || config_1.initConfig.router.base;
38
+ const basicPlugins = [];
39
+ const defineConfigData = (_c = (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.base) === null || _b === void 0 ? void 0 : _b.define) !== null && _c !== void 0 ? _c : {};
40
+ const formatObj = yield (0, config_1.getFormatDefineVars)(defineConfigData);
41
+ if (Object.keys(formatObj).length !== 0) {
42
+ basicPlugins.push(new core_1.rspack.DefinePlugin(formatObj));
43
+ }
44
+ return {
45
+ entry: entryPath,
46
+ output: {
47
+ path: path_1.default.join(projectPath, '/dist'),
48
+ filename: 'js/[name].[chunkhash].js',
49
+ assetModuleFilename: 'assets/[name]_[chunkhash][ext]',
50
+ publicPath,
51
+ clean: true
52
+ },
53
+ experiments: {
54
+ css: true
55
+ },
56
+ target: ['web', 'es5'],
57
+ cache: {
58
+ type: 'filesystem'
59
+ },
60
+ module: {
61
+ rules: [
62
+ {
63
+ test: /\.(tsx|ts|jsx)$/,
64
+ exclude: /node_modules/,
65
+ use: [
66
+ {
67
+ loader: require.resolve('builtin:swc-loader'),
68
+ options: {
69
+ jsc: {
70
+ parser: {
71
+ syntax: 'typescript',
72
+ tsx: true,
73
+ decorators: true,
74
+ dynamicImport: true
75
+ },
76
+ transform: {
77
+ react: {
78
+ runtime: 'automatic',
79
+ useBuiltins: true,
80
+ importSource: 'react'
81
+ }
82
+ },
83
+ target: 'es2015'
84
+ }
85
+ }
86
+ }
87
+ ]
88
+ },
89
+ {
90
+ oneOf: [
91
+ {
92
+ test: /\.css$/,
93
+ type: 'css/auto',
94
+ use: [
95
+ core_1.rspack.CssExtractRspackPlugin.loader,
96
+ cssLoader,
97
+ {
98
+ loader: postcssLoader,
99
+ options: {
100
+ postcssOptions: {
101
+ plugins: [['autoprefixer']]
102
+ }
103
+ }
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ test: /\.less$/,
109
+ type: 'css/auto',
110
+ use: [
111
+ core_1.rspack.CssExtractRspackPlugin.loader,
112
+ cssLoader,
113
+ {
114
+ loader: postcssLoader,
115
+ options: {
116
+ postcssOptions: {
117
+ plugins: [['autoprefixer']]
118
+ }
119
+ }
120
+ },
121
+ lessLoader
122
+ ]
123
+ },
124
+ {
125
+ test: /\.scss$/,
126
+ type: 'css/auto',
127
+ use: [
128
+ core_1.rspack.CssExtractRspackPlugin.loader,
129
+ cssLoader,
130
+ {
131
+ loader: postcssLoader,
132
+ options: {
133
+ postcssOptions: {
134
+ plugins: [['autoprefixer']]
135
+ }
136
+ }
137
+ },
138
+ sassLoader
139
+ ]
140
+ },
141
+ {
142
+ test: /\.(jpg|png|gif|webp|bmp|jpeg|svg)$/,
143
+ type: 'asset',
144
+ generator: {
145
+ filename: 'images/[name]_[contenthash][ext]'
146
+ }
147
+ },
148
+ {
149
+ test: /\.(otf|eot|woff2?|ttf)$/i,
150
+ type: 'asset',
151
+ generator: {
152
+ filename: 'fonts/[name]_[contenthash][ext]'
153
+ }
154
+ },
155
+ {
156
+ test: /\.(txt|xml)$/i,
157
+ type: 'asset/source'
158
+ },
159
+ {
160
+ test: /\.html$/,
161
+ loader: require.resolve('html-loader')
162
+ }
163
+ ]
164
+ }
165
+ ]
166
+ },
167
+ resolve: {
168
+ extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
169
+ alias: Object.assign({ '@': path_1.default.join(projectPath, '/src'), 'react-router-dom': path_1.default.dirname(require.resolve('react-router-dom')), qs: path_1.default.dirname(require.resolve('qs')) }, getCustomAliasConfig())
170
+ },
171
+ externals: customConfig.base.externals,
172
+ plugins: [
173
+ ...basicPlugins,
174
+ new core_1.rspack.HtmlRspackPlugin({
175
+ template: path_1.default.join(projectPath, '/src/index.ejs'),
176
+ filename: 'index.html',
177
+ minify: true,
178
+ templateParameters: {
179
+ publicPath,
180
+ routerBase
181
+ },
182
+ hash: true
183
+ }),
184
+ new core_1.rspack.CssExtractRspackPlugin({
185
+ filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
186
+ ignoreOrder: true
187
+ }),
188
+ ...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins)
189
+ ]
190
+ };
191
+ });
192
+ }
193
+ exports.default = default_1;
@@ -17,6 +17,9 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
17
17
  test: RegExp;
18
18
  loader: string;
19
19
  exclude: RegExp;
20
+ options: {
21
+ experimentalInlineMatchResource: boolean;
22
+ };
20
23
  use?: undefined;
21
24
  oneOf?: undefined;
22
25
  } | {
@@ -37,6 +40,7 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
37
40
  };
38
41
  }[];
39
42
  loader?: undefined;
43
+ options?: undefined;
40
44
  oneOf?: undefined;
41
45
  } | {
42
46
  oneOf: ({
@@ -61,7 +65,14 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
61
65
  };
62
66
  })[];
63
67
  } | {
64
- use: any[];
68
+ use: (string | {
69
+ loader: string;
70
+ options: {
71
+ postcssOptions: {
72
+ plugins: string[][];
73
+ };
74
+ };
75
+ })[];
65
76
  resourceQuery?: undefined;
66
77
  })[];
67
78
  type?: undefined;
@@ -91,6 +102,7 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
91
102
  test?: undefined;
92
103
  loader?: undefined;
93
104
  exclude?: undefined;
105
+ options?: undefined;
94
106
  use?: undefined;
95
107
  })[];
96
108
  };
@@ -0,0 +1,282 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const path_1 = __importDefault(require("path"));
16
+ const config_1 = require("../utils/config");
17
+ const vue_loader_1 = require("vue-loader");
18
+ const core_1 = require("@rspack/core");
19
+ const vueStyleLoader = require.resolve('vue-style-loader');
20
+ const cssLoader = require.resolve('css-loader');
21
+ const lessLoader = require.resolve('less-loader');
22
+ const sassLoader = require.resolve('sass-loader');
23
+ const postcssLoader = require.resolve('postcss-loader');
24
+ function default_1({ projectPath, entryPath, env, customConfig }) {
25
+ var _a, _b, _c;
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const customBaseConfig = customConfig.base;
28
+ const getCustomAliasConfig = () => {
29
+ const { alias } = customBaseConfig || {};
30
+ const custAliasConfig = {};
31
+ if (alias) {
32
+ Object.keys(alias).forEach((key) => {
33
+ custAliasConfig[key] = path_1.default.join(projectPath, `/${alias[key]}`);
34
+ });
35
+ }
36
+ return custAliasConfig;
37
+ };
38
+ const publicPath = (customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath) || config_1.initConfig.publicPath;
39
+ const routerBase = ((_a = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.router) === null || _a === void 0 ? void 0 : _a.base) || config_1.initConfig.router.base;
40
+ const basicPlugins = [];
41
+ const defineConfigData = (_c = (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.base) === null || _b === void 0 ? void 0 : _b.define) !== null && _c !== void 0 ? _c : {};
42
+ const formatObj = yield (0, config_1.getFormatDefineVars)(defineConfigData);
43
+ if (Object.keys(formatObj).length !== 0) {
44
+ basicPlugins.push(new core_1.rspack.DefinePlugin(formatObj));
45
+ }
46
+ return {
47
+ entry: entryPath,
48
+ output: {
49
+ path: path_1.default.join(projectPath, '/dist'),
50
+ filename: 'js/[name].[chunkhash].js',
51
+ assetModuleFilename: 'assets/[name]_[chunkhash][ext]',
52
+ publicPath,
53
+ clean: true
54
+ },
55
+ target: ['web', 'es5'],
56
+ cache: {
57
+ type: 'filesystem'
58
+ },
59
+ module: {
60
+ rules: [
61
+ {
62
+ test: /\.vue$/,
63
+ loader: require.resolve('vue-loader'),
64
+ exclude: /node_modules/,
65
+ options: {
66
+ experimentalInlineMatchResource: true
67
+ }
68
+ },
69
+ {
70
+ test: /\.(ts|js)$/,
71
+ exclude: /node_modules/,
72
+ use: [
73
+ {
74
+ loader: require.resolve('builtin:swc-loader'),
75
+ options: {
76
+ jsc: {
77
+ parser: {
78
+ syntax: 'typescript',
79
+ tsx: false,
80
+ decorators: true,
81
+ dynamicImport: true
82
+ },
83
+ target: 'es2015'
84
+ }
85
+ }
86
+ }
87
+ ]
88
+ },
89
+ {
90
+ 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
+ {
135
+ test: /\.less$/,
136
+ oneOf: [
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
+ ]
178
+ },
179
+ {
180
+ test: /\.scss$/,
181
+ oneOf: [
182
+ {
183
+ resourceQuery: /module/,
184
+ use: [
185
+ vueStyleLoader,
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
+ ]
223
+ },
224
+ {
225
+ test: /\.(jpg|png|gif|webp|bmp|jpeg|svg)$/,
226
+ type: 'asset',
227
+ generator: {
228
+ filename: 'images/[name]_[contenthash][ext]'
229
+ }
230
+ },
231
+ {
232
+ test: /\.(otf|eot|woff2?|ttf)$/i,
233
+ type: 'asset',
234
+ generator: {
235
+ filename: 'fonts/[name]_[contenthash][ext]'
236
+ }
237
+ },
238
+ {
239
+ test: /\.(txt|xml)$/i,
240
+ type: 'asset/source'
241
+ },
242
+ {
243
+ test: /\.html$/,
244
+ loader: require.resolve('html-loader')
245
+ }
246
+ ]
247
+ }
248
+ ]
249
+ },
250
+ resolve: {
251
+ extensions: ['.ts', '.js', '.vue', '.json'],
252
+ alias: Object.assign({ '@': path_1.default.join(projectPath, '/src'), vue: 'vue/dist/vue.esm-bundler.js', 'vue-router': path_1.default.dirname(require.resolve('vue-router')), qs: path_1.default.dirname(require.resolve('qs')) }, getCustomAliasConfig())
253
+ },
254
+ externals: customConfig.base.externals,
255
+ plugins: [
256
+ ...basicPlugins,
257
+ new vue_loader_1.VueLoaderPlugin(),
258
+ new core_1.rspack.DefinePlugin({
259
+ __VUE_OPTIONS_API__: true,
260
+ __VUE_PROD_DEVTOOLS__: false,
261
+ __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
262
+ }),
263
+ new core_1.rspack.HtmlRspackPlugin({
264
+ template: path_1.default.join(projectPath, '/src/index.ejs'),
265
+ filename: 'index.html',
266
+ minify: true,
267
+ templateParameters: {
268
+ publicPath,
269
+ routerBase
270
+ },
271
+ hash: true
272
+ }),
273
+ new core_1.CssExtractRspackPlugin({
274
+ filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
275
+ ignoreOrder: true
276
+ }),
277
+ ...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins)
278
+ ]
279
+ };
280
+ });
281
+ }
282
+ exports.default = default_1;