Skip to content

feat(babel-preset-app): pass full config to @babel/preset-env #5522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/@vue/babel-preset-app/__tests__/babel-preset.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,18 @@ test('should inject polyfills / helpers using "import" statements for an es modu
expect(code).toMatch('import "core-js/modules/es.promise"')
expect(code).not.toMatch('require(')
})

test('should not inject excluded polyfills', () => {
const { code } = babel.transformSync(`
new Promise()
`.trim(), {
babelrc: false,
presets: [[preset, {
exclude: ['es.promise'],
polyfills: ['es.array.iterator', 'es.object.assign']
}]],
filename: 'test-entry-file.js'
})

expect(code).not.toMatch('es.promise')
})
5 changes: 1 addition & 4 deletions packages/@vue/babel-preset-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,7 @@ module.exports = (context, options = {}) => {
// https://github.com/babel/babel/issues/9903
include: [/@babel[\/|\\\\]runtime/],
presets: [
[require('@babel/preset-env'), {
useBuiltIns,
corejs: useBuiltIns ? require('core-js/package.json').version : false
}]
[require('@babel/preset-env'), envOptions]
]
}]
}
Expand Down