swico 2.0.0-beta.21 → 2.0.0-beta.22

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.22",
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: {
54
+ localIdentName: string;
55
+ };
56
+ postcssOptions?: undefined;
62
57
  };
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[][];
58
+ } | {
59
+ loader: string;
60
+ options: {
61
+ postcssOptions: {
62
+ plugins: string[][];
63
+ };
64
+ modules?: 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,137 @@ 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: {
105
+ localIdentName: 'moduleStyle_[local]_[contenthash:8]'
106
+ }
107
+ }
108
+ },
109
+ {
110
+ loader: postcssLoader,
111
+ options: {
112
+ postcssOptions: {
113
+ plugins: [['autoprefixer']]
114
+ }
115
+ }
107
116
  }
108
- }
117
+ ]
109
118
  },
110
- lessLoader
119
+ {
120
+ use: [
121
+ env === 'dev'
122
+ ? vueStyleLoader
123
+ : core_1.CssExtractRspackPlugin.loader,
124
+ cssLoader,
125
+ {
126
+ loader: postcssLoader,
127
+ options: {
128
+ postcssOptions: {
129
+ plugins: [['autoprefixer']]
130
+ }
131
+ }
132
+ }
133
+ ]
134
+ }
135
+ ]
136
+ },
137
+ {
138
+ test: /\.less$/,
139
+ oneOf: [
140
+ {
141
+ resourceQuery: /module/,
142
+ use: [
143
+ vueStyleLoader,
144
+ {
145
+ loader: cssLoader,
146
+ options: {
147
+ modules: {
148
+ localIdentName: 'moduleStyle_[local]_[contenthash:8]'
149
+ }
150
+ }
151
+ },
152
+ {
153
+ loader: postcssLoader,
154
+ options: {
155
+ postcssOptions: {
156
+ plugins: [['autoprefixer']]
157
+ }
158
+ }
159
+ },
160
+ lessLoader
161
+ ]
162
+ },
163
+ {
164
+ use: [
165
+ env === 'dev'
166
+ ? vueStyleLoader
167
+ : core_1.CssExtractRspackPlugin.loader,
168
+ cssLoader,
169
+ {
170
+ loader: postcssLoader,
171
+ options: {
172
+ postcssOptions: {
173
+ plugins: [['autoprefixer']]
174
+ }
175
+ }
176
+ },
177
+ lessLoader
178
+ ]
179
+ }
111
180
  ]
112
181
  },
113
182
  {
114
183
  test: /\.scss$/,
115
- type: 'css',
116
- use: [
184
+ oneOf: [
117
185
  {
118
- loader: postcssLoader,
119
- options: {
120
- postcssOptions: {
121
- plugins: [['autoprefixer']]
122
- }
123
- }
186
+ resourceQuery: /module/,
187
+ use: [
188
+ vueStyleLoader,
189
+ {
190
+ loader: cssLoader,
191
+ options: {
192
+ modules: {
193
+ localIdentName: 'moduleStyle_[local]_[contenthash:8]'
194
+ }
195
+ }
196
+ },
197
+ {
198
+ loader: postcssLoader,
199
+ options: {
200
+ postcssOptions: {
201
+ plugins: [['autoprefixer']]
202
+ }
203
+ }
204
+ },
205
+ sassLoader
206
+ ]
124
207
  },
125
208
  {
126
- loader: sassLoader,
127
- options: {
128
- api: 'modern-compiler',
129
- implementation: require.resolve('sass-embedded')
130
- }
209
+ use: [
210
+ env === 'dev'
211
+ ? vueStyleLoader
212
+ : core_1.CssExtractRspackPlugin.loader,
213
+ cssLoader,
214
+ {
215
+ loader: postcssLoader,
216
+ options: {
217
+ postcssOptions: {
218
+ plugins: [['autoprefixer']]
219
+ }
220
+ }
221
+ },
222
+ sassLoader
223
+ ]
131
224
  }
132
225
  ]
133
226
  },
@@ -164,13 +257,14 @@ function default_1(_a) {
164
257
  externals: customConfig.base.externals,
165
258
  plugins: [
166
259
  ...basicPlugins,
260
+ new core_1.CssExtractRspackPlugin({}),
167
261
  new vue_loader_1.VueLoaderPlugin(),
168
- new core_1.rspack.DefinePlugin({
262
+ new core_1.DefinePlugin({
169
263
  __VUE_OPTIONS_API__: true,
170
264
  __VUE_PROD_DEVTOOLS__: false,
171
265
  __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
172
266
  }),
173
- new core_1.rspack.HtmlRspackPlugin({
267
+ new core_1.HtmlRspackPlugin({
174
268
  template: path_1.default.join(projectPath, '/src/index.ejs'),
175
269
  filename: 'index.html',
176
270
  minify: true,