@rsbuild/plugin-vue 1.0.2 → 1.0.4
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 +11 -15
- package/dist/index.js +11 -15
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -39,13 +39,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
39
|
const external_node_module_namespaceObject = require("node:module");
|
|
40
40
|
const external_vue_loader_namespaceObject = require("vue-loader");
|
|
41
41
|
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
42
|
-
const applySplitChunksRule =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
api.modifyBundlerChain((chain, param)=>{
|
|
48
|
-
let { environment } = param;
|
|
42
|
+
const applySplitChunksRule = (api, options = {
|
|
43
|
+
vue: true,
|
|
44
|
+
router: true
|
|
45
|
+
})=>{
|
|
46
|
+
api.modifyBundlerChain((chain, { environment })=>{
|
|
49
47
|
const { config } = environment;
|
|
50
48
|
if ('split-by-experience' !== config.performance.chunkSplit.strategy) return;
|
|
51
49
|
const currentConfig = chain.optimization.splitChunks.values();
|
|
@@ -65,8 +63,9 @@ const applySplitChunksRule = function(api) {
|
|
|
65
63
|
chain.optimization.splitChunks({
|
|
66
64
|
...currentConfig,
|
|
67
65
|
cacheGroups: {
|
|
68
|
-
|
|
69
|
-
...extraGroups
|
|
66
|
+
// user defined cache groups take precedence
|
|
67
|
+
...extraGroups,
|
|
68
|
+
...currentConfig.cacheGroups
|
|
70
69
|
}
|
|
71
70
|
});
|
|
72
71
|
});
|
|
@@ -75,15 +74,13 @@ const src_require = (0, external_node_module_namespaceObject.createRequire)(/*#_
|
|
|
75
74
|
return 'undefined' == typeof document ? new (module.require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
76
75
|
}());
|
|
77
76
|
const PLUGIN_VUE_NAME = 'rsbuild:vue';
|
|
78
|
-
function pluginVue() {
|
|
79
|
-
let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
77
|
+
function pluginVue(options = {}) {
|
|
80
78
|
return {
|
|
81
79
|
name: PLUGIN_VUE_NAME,
|
|
82
80
|
setup (api) {
|
|
83
81
|
const VUE_REGEXP = /\.vue$/;
|
|
84
82
|
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
85
|
-
api.modifyEnvironmentConfig((config,
|
|
86
|
-
let { mergeEnvironmentConfig } = param;
|
|
83
|
+
api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig })=>{
|
|
87
84
|
const extraConfig = {
|
|
88
85
|
source: {
|
|
89
86
|
define: {
|
|
@@ -102,8 +99,7 @@ function pluginVue() {
|
|
|
102
99
|
};
|
|
103
100
|
return merged;
|
|
104
101
|
});
|
|
105
|
-
api.modifyBundlerChain(async (chain,
|
|
106
|
-
let { CHAIN_ID } = param;
|
|
102
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID })=>{
|
|
107
103
|
chain.resolve.extensions.add('.vue');
|
|
108
104
|
const userLoaderOptions = options.vueLoaderOptions ?? {};
|
|
109
105
|
const compilerOptions = {
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_node_module__ from "node:module";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_vue_loader__ from "vue-loader";
|
|
3
3
|
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
4
|
-
const applySplitChunksRule =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
api.modifyBundlerChain((chain, param)=>{
|
|
10
|
-
let { environment } = param;
|
|
4
|
+
const applySplitChunksRule = (api, options = {
|
|
5
|
+
vue: true,
|
|
6
|
+
router: true
|
|
7
|
+
})=>{
|
|
8
|
+
api.modifyBundlerChain((chain, { environment })=>{
|
|
11
9
|
const { config } = environment;
|
|
12
10
|
if ('split-by-experience' !== config.performance.chunkSplit.strategy) return;
|
|
13
11
|
const currentConfig = chain.optimization.splitChunks.values();
|
|
@@ -27,23 +25,22 @@ const applySplitChunksRule = function(api) {
|
|
|
27
25
|
chain.optimization.splitChunks({
|
|
28
26
|
...currentConfig,
|
|
29
27
|
cacheGroups: {
|
|
30
|
-
|
|
31
|
-
...extraGroups
|
|
28
|
+
// user defined cache groups take precedence
|
|
29
|
+
...extraGroups,
|
|
30
|
+
...currentConfig.cacheGroups
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
33
|
});
|
|
35
34
|
};
|
|
36
35
|
const src_require = (0, __WEBPACK_EXTERNAL_MODULE_node_module__.createRequire)(import.meta.url);
|
|
37
36
|
const PLUGIN_VUE_NAME = 'rsbuild:vue';
|
|
38
|
-
function pluginVue() {
|
|
39
|
-
let options = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
37
|
+
function pluginVue(options = {}) {
|
|
40
38
|
return {
|
|
41
39
|
name: PLUGIN_VUE_NAME,
|
|
42
40
|
setup (api) {
|
|
43
41
|
const VUE_REGEXP = /\.vue$/;
|
|
44
42
|
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
45
|
-
api.modifyEnvironmentConfig((config,
|
|
46
|
-
let { mergeEnvironmentConfig } = param;
|
|
43
|
+
api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig })=>{
|
|
47
44
|
const extraConfig = {
|
|
48
45
|
source: {
|
|
49
46
|
define: {
|
|
@@ -62,8 +59,7 @@ function pluginVue() {
|
|
|
62
59
|
};
|
|
63
60
|
return merged;
|
|
64
61
|
});
|
|
65
|
-
api.modifyBundlerChain(async (chain,
|
|
66
|
-
let { CHAIN_ID } = param;
|
|
62
|
+
api.modifyBundlerChain(async (chain, { CHAIN_ID })=>{
|
|
67
63
|
chain.resolve.extensions.add('.vue');
|
|
68
64
|
const userLoaderOptions = options.vueLoaderOptions ?? {};
|
|
69
65
|
const compilerOptions = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-vue",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Vue 3 plugin of Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"vue-loader": "^17.4.2",
|
|
27
|
-
"webpack": "^5.
|
|
27
|
+
"webpack": "^5.96.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"typescript": "^5.6.3",
|
|
31
31
|
"vue": "^3.5.12",
|
|
32
|
-
"webpack": "^5.
|
|
33
|
-
"@rsbuild/core": "1.0
|
|
32
|
+
"webpack": "^5.96.1",
|
|
33
|
+
"@rsbuild/core": "1.1.0",
|
|
34
34
|
"@scripts/test-helper": "1.0.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@rsbuild/core": "1.x
|
|
37
|
+
"@rsbuild/core": "1.x"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public",
|