Skip to content

Commit baa6c10

Browse files
committed
refact: remove updateMain in usePolifill
it is replaced with updateFile method
1 parent f8c44d7 commit baa6c10

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

generator/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,13 @@ module.exports = (api, opts, rootOpts) => {
8686
return cfg
8787
})
8888

89-
helpers.updateMain(src => {
90-
if (!src.find(l => l.match(/^(import|require).+mutationobserver-shim.*$/))) {
91-
src.unshift('import \'mutationobserver-shim\'')
89+
helpers.updateFile(api.resolve(api.entryFile), srcLines => {
90+
if (!srcLines.find(line => line.match(/^(import|require).+mutationobserver-shim.*$/))) {
91+
srcLines.unshift('import \'mutationobserver-shim\'')
9292
}
93-
if (!src.find(l => l.match(/^(import|require).+@babel\/polyfill.*$/))) {
94-
src.unshift('import \'@babel/polyfill\'')
93+
if (!srcLines.find(line => line.match(/^(import|require).+@babel\/polyfill.*$/))) {
94+
srcLines.unshift('import \'@babel/polyfill\'')
9595
}
96-
return src
9796
})
9897
}
9998
})

0 commit comments

Comments
 (0)