@rsbuild/plugin-vue2 0.7.0-beta.3 → 0.7.0-beta.5

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/dist/index.cjs CHANGED
@@ -121,6 +121,22 @@ function pluginVue2(options = {}) {
121
121
  return {
122
122
  name: "rsbuild:vue2",
123
123
  setup(api) {
124
+ const VUE_REGEXP = /\.vue$/;
125
+ const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
126
+ api.modifyRsbuildConfig((config) => {
127
+ var _a;
128
+ config.output || (config.output = {});
129
+ (_a = config.output).cssModules || (_a.cssModules = {});
130
+ if (config.output.cssModules.auto === true) {
131
+ config.output.cssModules.auto = (path, query) => {
132
+ if (VUE_REGEXP.test(path)) {
133
+ return query.includes("type=style") && query.includes("module=true");
134
+ }
135
+ return CSS_MODULES_REGEX.test(path);
136
+ };
137
+ }
138
+ return config;
139
+ });
124
140
  api.modifyBundlerChain((chain, { CHAIN_ID }) => {
125
141
  chain.resolve.extensions.add(".vue");
126
142
  if (!chain.resolve.alias.get("vue$")) {
@@ -135,7 +151,7 @@ function pluginVue2(options = {}) {
135
151
  },
136
152
  options.vueLoaderOptions ?? {}
137
153
  );
138
- chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(require.resolve("vue-loader")).options(vueLoaderOptions);
154
+ chain.module.rule(CHAIN_ID.RULE.VUE).test(VUE_REGEXP).use(CHAIN_ID.USE.VUE).loader(require.resolve("vue-loader")).options(vueLoaderOptions);
139
155
  chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(import_vue_loader.VueLoaderPlugin);
140
156
  chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_15_PITCH_FIX_PLUGIN).use(VueLoader15PitchFixPlugin);
141
157
  });
package/dist/index.js CHANGED
@@ -106,6 +106,22 @@ function pluginVue2(options = {}) {
106
106
  return {
107
107
  name: "rsbuild:vue2",
108
108
  setup(api) {
109
+ const VUE_REGEXP = /\.vue$/;
110
+ const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
111
+ api.modifyRsbuildConfig((config) => {
112
+ var _a;
113
+ config.output || (config.output = {});
114
+ (_a = config.output).cssModules || (_a.cssModules = {});
115
+ if (config.output.cssModules.auto === true) {
116
+ config.output.cssModules.auto = (path2, query) => {
117
+ if (VUE_REGEXP.test(path2)) {
118
+ return query.includes("type=style") && query.includes("module=true");
119
+ }
120
+ return CSS_MODULES_REGEX.test(path2);
121
+ };
122
+ }
123
+ return config;
124
+ });
109
125
  api.modifyBundlerChain((chain, { CHAIN_ID }) => {
110
126
  chain.resolve.extensions.add(".vue");
111
127
  if (!chain.resolve.alias.get("vue$")) {
@@ -120,7 +136,7 @@ function pluginVue2(options = {}) {
120
136
  },
121
137
  options.vueLoaderOptions ?? {}
122
138
  );
123
- chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(__require.resolve("vue-loader")).options(vueLoaderOptions);
139
+ chain.module.rule(CHAIN_ID.RULE.VUE).test(VUE_REGEXP).use(CHAIN_ID.USE.VUE).loader(__require.resolve("vue-loader")).options(vueLoaderOptions);
124
140
  chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(VueLoaderPlugin);
125
141
  chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_15_PITCH_FIX_PLUGIN).use(VueLoader15PitchFixPlugin);
126
142
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-vue2",
3
- "version": "0.7.0-beta.3",
3
+ "version": "0.7.0-beta.5",
4
4
  "description": "Vue 2 plugin of Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -25,16 +25,16 @@
25
25
  "dependencies": {
26
26
  "vue-loader": "^15.11.1",
27
27
  "webpack": "^5.91.0",
28
- "@rsbuild/shared": "0.7.0-beta.3"
28
+ "@rsbuild/shared": "0.7.0-beta.5"
29
29
  },
30
30
  "devDependencies": {
31
31
  "typescript": "^5.4.2",
32
32
  "webpack": "^5.91.0",
33
- "@rsbuild/core": "0.7.0-beta.3",
34
- "@scripts/test-helper": "0.7.0-beta.3"
33
+ "@rsbuild/core": "0.7.0-beta.5",
34
+ "@scripts/test-helper": "0.7.0-beta.5"
35
35
  },
36
36
  "peerDependencies": {
37
- "@rsbuild/core": "^0.7.0-beta.3"
37
+ "@rsbuild/core": "^0.7.0-beta.5"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public",