swico 2.0.0-beta.20 → 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.20",
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,48 +45,58 @@ 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
- };
58
+ } | {
59
+ loader: string;
60
+ options: {
61
+ postcssOptions: {
62
+ plugins: string[][];
63
+ };
64
+ modules?: undefined;
65
+ };
66
+ })[];
67
+ } | {
68
+ use: (string | {
69
+ loader: string;
70
+ options: {
71
+ postcssOptions: {
72
+ plugins: string[][];
73
+ };
74
+ };
75
+ })[];
76
+ resourceQuery?: undefined;
64
77
  })[];
65
- loader?: undefined;
66
- generator?: undefined;
67
- } | {
68
- test: RegExp;
69
- type: string;
70
- loader: string;
71
- use: {
72
- loader: string;
73
- options: {
74
- api: string;
75
- implementation: string;
76
- };
77
- }[];
78
+ type?: undefined;
78
79
  generator?: undefined;
80
+ loader?: undefined;
79
81
  } | {
80
82
  test: RegExp;
81
83
  type: string;
82
84
  generator: {
83
85
  filename: string;
84
86
  };
85
- use?: undefined;
87
+ oneOf?: undefined;
86
88
  loader?: undefined;
87
89
  } | {
88
90
  test: RegExp;
89
91
  type: string;
90
- use?: undefined;
91
- loader?: undefined;
92
+ oneOf?: undefined;
92
93
  generator?: undefined;
94
+ loader?: undefined;
93
95
  } | {
94
96
  test: RegExp;
95
97
  loader: string;
98
+ oneOf?: undefined;
96
99
  type?: undefined;
97
- use?: undefined;
98
100
  generator?: undefined;
99
101
  })[];
100
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,31 +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: [
95
+ {
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
+ }
116
+ }
117
+ ]
118
+ },
102
119
  {
103
- loader: postcssLoader,
104
- options: {
105
- postcssOptions: {
106
- plugins: [['autoprefixer']]
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
+ }
107
132
  }
108
- }
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
+ ]
109
162
  },
110
- lessLoader
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
- loader: sassLoader,
117
- use: [
184
+ oneOf: [
185
+ {
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
+ ]
207
+ },
118
208
  {
119
- loader: sassLoader,
120
- options: {
121
- api: 'modern-compiler',
122
- implementation: require.resolve('sass-embedded')
123
- }
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
+ ]
124
224
  }
125
225
  ]
126
226
  },
@@ -157,13 +257,14 @@ function default_1(_a) {
157
257
  externals: customConfig.base.externals,
158
258
  plugins: [
159
259
  ...basicPlugins,
260
+ new core_1.CssExtractRspackPlugin({}),
160
261
  new vue_loader_1.VueLoaderPlugin(),
161
- new core_1.rspack.DefinePlugin({
262
+ new core_1.DefinePlugin({
162
263
  __VUE_OPTIONS_API__: true,
163
264
  __VUE_PROD_DEVTOOLS__: false,
164
265
  __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
165
266
  }),
166
- new core_1.rspack.HtmlRspackPlugin({
267
+ new core_1.HtmlRspackPlugin({
167
268
  template: path_1.default.join(projectPath, '/src/index.ejs'),
168
269
  filename: 'index.html',
169
270
  minify: true,