mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix(babel-preset-app): avoid rely on preset-env utils (#8883)
This commit is contained in:
parent
4a60a1934c
commit
4e3613f96f
@ -13,6 +13,7 @@
|
|||||||
"@babel/compat-data": "^7.12.13",
|
"@babel/compat-data": "^7.12.13",
|
||||||
"@babel/core": "^7.12.17",
|
"@babel/core": "^7.12.17",
|
||||||
"@babel/helper-compilation-targets": "^7.12.17",
|
"@babel/helper-compilation-targets": "^7.12.17",
|
||||||
|
"@babel/helper-module-imports": "^7.12.13",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
"@babel/plugin-proposal-class-properties": "^7.12.13",
|
||||||
"@babel/plugin-proposal-decorators": "^7.12.13",
|
"@babel/plugin-proposal-decorators": "^7.12.13",
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13",
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.13",
|
||||||
|
@ -1,4 +1,18 @@
|
|||||||
// Add polyfill imports to the first file encountered.
|
// Add polyfill imports to the first file encountered.
|
||||||
|
const { addSideEffect } = require('@babel/helper-module-imports')
|
||||||
|
|
||||||
|
const modulePathMap = {
|
||||||
|
'regenerator-runtime': 'regenerator-runtime/runtime.js'
|
||||||
|
}
|
||||||
|
|
||||||
|
function getModulePath (mod) {
|
||||||
|
return modulePathMap[mod] || 'core-js/modules/' + mod + '.js'
|
||||||
|
}
|
||||||
|
|
||||||
|
function createImport (path, mod) {
|
||||||
|
return addSideEffect(path, getModulePath(mod))
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = ({ types }) => {
|
module.exports = ({ types }) => {
|
||||||
let entryFile
|
let entryFile
|
||||||
return {
|
return {
|
||||||
@ -12,7 +26,6 @@ module.exports = ({ types }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { polyfills } = state.opts
|
const { polyfills } = state.opts
|
||||||
const { createImport } = require('@babel/preset-env/lib/utils')
|
|
||||||
|
|
||||||
// Imports are injected in reverse order
|
// Imports are injected in reverse order
|
||||||
polyfills.slice().reverse().forEach((p) => {
|
polyfills.slice().reverse().forEach((p) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user