swico 2.0.0-beta.21 → 2.0.0-beta.23

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.21",
3
+ "version": "2.0.0-beta.23",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -58,6 +58,7 @@
58
58
  "ts-node": "10.9.1",
59
59
  "vue-loader": "17.4.2",
60
60
  "vue-router": "4.5.0",
61
+ "vue-style-loader": "4.1.3",
61
62
  "webpack-bundle-analyzer": "4.9.1",
62
63
  "webpack-merge": "6.0.1",
63
64
  "webpackbar": "7.0.0"
@@ -11,16 +11,8 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
11
11
  publicPath: string;
12
12
  clean: boolean;
13
13
  };
14
- experiments: {
15
- css: boolean;
16
- };
17
14
  target: string[];
18
15
  module: {
19
- parser: {
20
- 'css/auto': {
21
- namedExports: boolean;
22
- };
23
- };
24
16
  rules: ({
25
17
  test: RegExp;
26
18
  loader: string;
@@ -53,37 +45,37 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
53
45
  } | {
54
46
  oneOf: ({
55
47
  test: RegExp;
56
- type: string;
57
- use: (string | {
58
- loader: string;
59
- options: {
60
- postcssOptions: {
61
- plugins: string[][];
48
+ oneOf: ({
49
+ resourceQuery: RegExp;
50
+ use: (string | {
51
+ loader: string;
52
+ options: {
53
+ modules: boolean;
54
+ localIdentName: string;
55
+ postcssOptions?: undefined;
62
56
  };
63
- };
64
- })[];
65
- generator?: undefined;
66
- loader?: undefined;
67
- } | {
68
- test: RegExp;
69
- type: string;
70
- use: ({
71
- loader: string;
72
- options: {
73
- postcssOptions: {
74
- plugins: string[][];
57
+ } | {
58
+ loader: string;
59
+ options: {
60
+ postcssOptions: {
61
+ plugins: string[][];
62
+ };
63
+ modules?: undefined;
64
+ localIdentName?: undefined;
75
65
  };
76
- api?: undefined;
77
- implementation?: undefined;
78
- };
66
+ })[];
79
67
  } | {
80
- loader: string;
81
- options: {
82
- api: string;
83
- implementation: string;
84
- postcssOptions?: undefined;
85
- };
68
+ use: (string | {
69
+ loader: string;
70
+ options: {
71
+ postcssOptions: {
72
+ plugins: string[][];
73
+ };
74
+ };
75
+ })[];
76
+ resourceQuery?: undefined;
86
77
  })[];
78
+ type?: undefined;
87
79
  generator?: undefined;
88
80
  loader?: undefined;
89
81
  } | {
@@ -92,19 +84,19 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
92
84
  generator: {
93
85
  filename: string;
94
86
  };
95
- use?: undefined;
87
+ oneOf?: undefined;
96
88
  loader?: undefined;
97
89
  } | {
98
90
  test: RegExp;
99
91
  type: string;
100
- use?: undefined;
92
+ oneOf?: undefined;
101
93
  generator?: undefined;
102
94
  loader?: undefined;
103
95
  } | {
104
96
  test: RegExp;
105
97
  loader: string;
98
+ oneOf?: undefined;
106
99
  type?: undefined;
107
- use?: undefined;
108
100
  generator?: undefined;
109
101
  })[];
110
102
  test?: undefined;
@@ -17,6 +17,8 @@ const path_1 = __importDefault(require("path"));
17
17
  const config_1 = require("../utils/config");
18
18
  const vue_loader_1 = require("vue-loader");
19
19
  const core_1 = require("@rspack/core");
20
+ const vueStyleLoader = require.resolve('vue-style-loader');
21
+ const cssLoader = require.resolve('css-loader');
20
22
  const lessLoader = require.resolve('less-loader');
21
23
  const sassLoader = require.resolve('sass-loader');
22
24
  const postcssLoader = require.resolve('postcss-loader');
@@ -40,7 +42,7 @@ function default_1(_a) {
40
42
  const defineConfigData = (_d = (_c = customConfig === null || customConfig === void 0 ? void 0 : customConfig.base) === null || _c === void 0 ? void 0 : _c.define) !== null && _d !== void 0 ? _d : {};
41
43
  const formatObj = yield (0, config_1.getFormatDefineVars)(defineConfigData);
42
44
  if (Object.keys(formatObj).length !== 0) {
43
- basicPlugins.push(new core_1.rspack.DefinePlugin(formatObj));
45
+ basicPlugins.push(new core_1.DefinePlugin(formatObj));
44
46
  }
45
47
  return {
46
48
  entry: entryPath,
@@ -54,16 +56,8 @@ function default_1(_a) {
54
56
  publicPath,
55
57
  clean: true
56
58
  },
57
- experiments: {
58
- css: true
59
- },
60
59
  target: ['web', 'es5'],
61
60
  module: {
62
- parser: {
63
- 'css/auto': {
64
- namedExports: false
65
- }
66
- },
67
61
  rules: [
68
62
  {
69
63
  test: /\.vue$/,
@@ -96,38 +90,134 @@ function default_1(_a) {
96
90
  {
97
91
  oneOf: [
98
92
  {
99
- test: /\.less$/,
100
- type: 'css',
101
- use: [
93
+ test: /\.css$/,
94
+ oneOf: [
102
95
  {
103
- loader: postcssLoader,
104
- options: {
105
- postcssOptions: {
106
- plugins: [['autoprefixer']]
96
+ resourceQuery: /module/,
97
+ use: [
98
+ env === 'dev'
99
+ ? vueStyleLoader
100
+ : core_1.CssExtractRspackPlugin.loader,
101
+ {
102
+ loader: cssLoader,
103
+ options: {
104
+ modules: true,
105
+ localIdentName: 'moduleStyle_[local]_[contenthash:8]'
106
+ }
107
+ },
108
+ {
109
+ loader: postcssLoader,
110
+ options: {
111
+ postcssOptions: {
112
+ plugins: [['autoprefixer']]
113
+ }
114
+ }
107
115
  }
108
- }
116
+ ]
109
117
  },
110
- lessLoader
118
+ {
119
+ use: [
120
+ env === 'dev'
121
+ ? vueStyleLoader
122
+ : core_1.CssExtractRspackPlugin.loader,
123
+ cssLoader,
124
+ {
125
+ loader: postcssLoader,
126
+ options: {
127
+ postcssOptions: {
128
+ plugins: [['autoprefixer']]
129
+ }
130
+ }
131
+ }
132
+ ]
133
+ }
134
+ ]
135
+ },
136
+ {
137
+ test: /\.less$/,
138
+ oneOf: [
139
+ {
140
+ resourceQuery: /module/,
141
+ use: [
142
+ vueStyleLoader,
143
+ {
144
+ loader: cssLoader,
145
+ options: {
146
+ modules: true,
147
+ localIdentName: 'moduleStyle_[local]_[contenthash:8]'
148
+ }
149
+ },
150
+ {
151
+ loader: postcssLoader,
152
+ options: {
153
+ postcssOptions: {
154
+ plugins: [['autoprefixer']]
155
+ }
156
+ }
157
+ },
158
+ lessLoader
159
+ ]
160
+ },
161
+ {
162
+ use: [
163
+ env === 'dev'
164
+ ? vueStyleLoader
165
+ : core_1.CssExtractRspackPlugin.loader,
166
+ cssLoader,
167
+ {
168
+ loader: postcssLoader,
169
+ options: {
170
+ postcssOptions: {
171
+ plugins: [['autoprefixer']]
172
+ }
173
+ }
174
+ },
175
+ lessLoader
176
+ ]
177
+ }
111
178
  ]
112
179
  },
113
180
  {
114
181
  test: /\.scss$/,
115
- type: 'css',
116
- use: [
182
+ oneOf: [
117
183
  {
118
- loader: postcssLoader,
119
- options: {
120
- postcssOptions: {
121
- plugins: [['autoprefixer']]
122
- }
123
- }
184
+ resourceQuery: /module/,
185
+ use: [
186
+ vueStyleLoader,
187
+ {
188
+ loader: cssLoader,
189
+ options: {
190
+ modules: true,
191
+ localIdentName: 'moduleStyle_[local]_[contenthash:8]'
192
+ }
193
+ },
194
+ {
195
+ loader: postcssLoader,
196
+ options: {
197
+ postcssOptions: {
198
+ plugins: [['autoprefixer']]
199
+ }
200
+ }
201
+ },
202
+ sassLoader
203
+ ]
124
204
  },
125
205
  {
126
- loader: sassLoader,
127
- options: {
128
- api: 'modern-compiler',
129
- implementation: require.resolve('sass-embedded')
130
- }
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
+ ]
131
221
  }
132
222
  ]
133
223
  },
@@ -164,13 +254,14 @@ function default_1(_a) {
164
254
  externals: customConfig.base.externals,
165
255
  plugins: [
166
256
  ...basicPlugins,
257
+ new core_1.CssExtractRspackPlugin({}),
167
258
  new vue_loader_1.VueLoaderPlugin(),
168
- new core_1.rspack.DefinePlugin({
259
+ new core_1.DefinePlugin({
169
260
  __VUE_OPTIONS_API__: true,
170
261
  __VUE_PROD_DEVTOOLS__: false,
171
262
  __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
172
263
  }),
173
- new core_1.rspack.HtmlRspackPlugin({
264
+ new core_1.HtmlRspackPlugin({
174
265
  template: path_1.default.join(projectPath, '/src/index.ejs'),
175
266
  filename: 'index.html',
176
267
  minify: true,