Skip to content
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

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

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions packages/@vue/babel-preset-app/__tests__/babel-preset.spec.js
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
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