File tree 3 files changed +17
-5
lines changed
packages/@vue/babel-preset-app
3 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -97,3 +97,9 @@ Set to `false` to disable JSX support.
97
97
- Default: ` false ` .
98
98
99
99
Setting this to ` true ` will generate code that is more performant but less spec-compliant.
100
+
101
+ ### entryFiles
102
+
103
+ - Default: ` [] `
104
+
105
+ Multi page repo use entryFiles to ensure inject polyfills to all entry file.
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ module.exports = (context, options = {}) => {
52
52
forceAllTransforms,
53
53
decoratorsBeforeExport,
54
54
decoratorsLegacy,
55
+ // entry file list
56
+ entryFiles,
55
57
56
58
// Undocumented option of @babel /plugin-transform-runtime.
57
59
// When enabled, an absolute path is used when importing a runtime helper atfer tranforming.
@@ -103,7 +105,7 @@ module.exports = (context, options = {}) => {
103
105
ignoreBrowserslistConfig,
104
106
configPath
105
107
} )
106
- plugins . push ( [ require ( './polyfillsPlugin' ) , { polyfills } ] )
108
+ plugins . push ( [ require ( './polyfillsPlugin' ) , { polyfills, entryFiles } ] )
107
109
} else {
108
110
polyfills = [ ]
109
111
}
Original file line number Diff line number Diff line change 1
1
// add polyfill imports to the first file encountered.
2
- module . exports = ( { types } ) => {
2
+ module . exports = ( { types } , { entryFiles = [ ] } ) => {
3
3
let entryFile
4
4
return {
5
5
name : 'vue-cli-inject-polyfills' ,
6
6
visitor : {
7
7
Program ( path , state ) {
8
- if ( ! entryFile ) {
9
- entryFile = state . filename
10
- } else if ( state . filename !== entryFile ) {
8
+ if ( entryFiles . length === 0 ) {
9
+ if ( ! entryFile ) {
10
+ entryFile = state . filename
11
+ } else if ( state . filename !== entryFile ) {
12
+ return
13
+ }
14
+ } else if ( ! entryFiles . includes ( state . filename ) ) {
11
15
return
12
16
}
13
17
You can’t perform that action at this time.
0 commit comments