File tree Expand file tree Collapse file tree 3 files changed +17
-5
lines changed
packages/@vue/babel-preset-app Expand file tree Collapse file tree 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.
9797- Default: ` false ` .
9898
9999Setting 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 = {}) => {
5252 forceAllTransforms,
5353 decoratorsBeforeExport,
5454 decoratorsLegacy,
55+ // entry file list
56+ entryFiles,
5557
5658 // Undocumented option of @babel /plugin-transform-runtime.
5759 // When enabled, an absolute path is used when importing a runtime helper atfer tranforming.
@@ -103,7 +105,7 @@ module.exports = (context, options = {}) => {
103105 ignoreBrowserslistConfig,
104106 configPath
105107 } )
106- plugins . push ( [ require ( './polyfillsPlugin' ) , { polyfills } ] )
108+ plugins . push ( [ require ( './polyfillsPlugin' ) , { polyfills, entryFiles } ] )
107109 } else {
108110 polyfills = [ ]
109111 }
Original file line number Diff line number Diff line change 11// add polyfill imports to the first file encountered.
2- module . exports = ( { types } ) => {
2+ module . exports = ( { types } , { entryFiles = [ ] } ) => {
33 let entryFile
44 return {
55 name : 'vue-cli-inject-polyfills' ,
66 visitor : {
77 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 ) ) {
1115 return
1216 }
1317
You can’t perform that action at this time.
0 commit comments