vue-cli: Build fails with @babel/preset-env 7.4.0

This has been fixed in @babel/preset-env@7.4.1. You will need to delete yarn.lock/package-lock.json and run yarn/npm i again.

Version

3.5.1

Environment info


Environment Info:

  System:
    OS: Linux 4.18 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (12) x64 Intel(R) Xeon(R) CPU D-1531 @ 2.20GHz
  Binaries:
    Node: 11.12.0 - /usr/bin/node
    Yarn: 1.15.2 - /usr/bin/yarn
    npm: 6.7.0 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0-beta.2
    @vue/babel-plugin-transform-vue-jsx:  1.0.0-beta.2
    @vue/babel-preset-app:  3.5.1
    @vue/babel-preset-jsx:  1.0.0-beta.2
    @vue/babel-sugar-functional-vue:  1.0.0-beta.2
    @vue/babel-sugar-inject-h:  1.0.0-beta.2
    @vue/babel-sugar-v-model:  1.0.0-beta.2
    @vue/babel-sugar-v-on:  1.0.0-beta.2
    @vue/cli-overlay:  3.5.1
    @vue/cli-plugin-babel: ^3.5.0 => 3.5.1
    @vue/cli-plugin-eslint: ^3.5.0 => 3.5.1
    @vue/cli-service: ^3.5.0 => 3.5.1
    @vue/cli-shared-utils:  3.5.1
    @vue/component-compiler-utils:  2.6.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.2
    vue: ^2.6.6 => 2.6.9
    vue-eslint-parser:  5.0.0
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.0
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.21 => 2.6.9
    vue-template-es2015-compiler:  1.9.1
  npmGlobalPackages:
    @vue/cli: Not Found


Steps to reproduce

yarn global add @vue/cli
vue create -d vue-cli-test
cd vue-cli-test
yarn build

What is expected?

A successful build.

What is actually happening?

The build fails because @babel/preset-env/data/built-ins.json can’t be found. It seems this file doesn’t exist anymore as of @babel/preset-env 7.4.0.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 12
  • Comments: 38 (1 by maintainers)

Commits related to this issue

Most upvoted comments

We just released @babel/preset-env@7.4.1, which should fix the issue.

I have the same issue. Full error output looks like

 ERROR  Failed to compile with 1 errors                                                                         01:04:29

 error  in ./src/main.js

Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: [BABEL] /home/bob/git/misc/test/src/main.js: Cannot find module '@babel/preset-env/data/built-ins.json' (While processing: "/home/bob/git/misc/test/node_modules/@vue/babel-preset-app/index.js")
    at Function.Module._resolveFilename (module.js:547:15)
    at Function.Module._load (module.js:474:25)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at getPolyfills (/home/bob/git/misc/test/node_modules/@vue/babel-preset-app/index.js:18:24)
    at module.exports (/home/bob/git/misc/test/node_modules/@vue/babel-preset-app/index.js:105:17)
    at loadDescriptor (/home/bob/git/misc/test/node_modules/@babel/core/lib/config/full.js:165:14)
    at cachedFunction (/home/bob/git/misc/test/node_modules/@babel/core/lib/config/caching.js:33:19)
    at loadPresetDescriptor (/home/bob/git/misc/test/node_modules/@babel/core/lib/config/full.js:235:63)
    at config.presets.reduce (/home/bob/git/misc/test/node_modules/@babel/core/lib/config/full.js:77:21)
    at Array.reduce (<anonymous>)
    at recurseDescriptors (/home/bob/git/misc/test/node_modules/@babel/core/lib/config/full.js:74:38)
    at loadFullConfig (/home/bob/git/misc/test/node_modules/@babel/core/lib/config/full.js:108:6)
    at process.nextTick (/home/bob/git/misc/test/node_modules/@babel/core/lib/transform.js:28:33)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

 @ multi (webpack)-dev-server/client?http://192.168.1.182:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

OK, I am working again. 😃

One thing I noticed was:

With `useBuiltIns` option, required direct setting of `corejs` option

@nicolo-ribaudo I’ve added a note at the top.

In the meantime adding "@babel/preset-env": "7.3.4", to your package.json should do the trick.

I had to delete yarn.lock. You may be able to find the reference to 7.4.0 in the lockfile as well and remove that manually.

isPluginRequired has moved and the built-ins have changed to corejs2-built-ins.json. The following update resolves the issue:

const { isPluginRequired } = require('@babel/preset-env/lib/filter-items')
const builtInsList = require('@babel/preset-env/data/corejs2-built-ins.json')

Edit: I forgot to specify the file @vue/babel-preset-app/index.js

In the meantime adding "@babel/preset-env": "7.3.4", to your package.json should do the trick.

Can confirm, does work! 😃

This PR was merged 2 hours ago & includes a commit that deleted the built-ins.json file.

PR: babel/babel#7646 Commit: babel/babel@3303b07#diff-0ec74dc48ab9f3209ac7e2816fb79b21

EDIT: Oh sorry, @AegirLeet already mentioned the commit 🤐

A PR has been open bringing back isPluginRequired but won’t fix the built-ins.json issue. https://github.com/babel/babel/pull/9709 Issue related: https://github.com/babel/babel/issues/9707

@markg85

  1. make sure the local @vue/cli-plugin-babel dependency in your project is the latest version
  2. if that doesn’t help, try to run npm install --save core-js@2 in the project root.

No I get the other error:

Module build failed (from ./node_modules/babel-loader/lib/index.js):
TypeError: [BABEL] ./src/main.js: isPluginRequired 
is not a function (While processing: "./node_modules/@vue/babel-preset-app/index.js")

@nicolo-ribaudo Yeah, that seems to fix the issue.

Ok, isPluginRequired was just merged in https://github.com/babel/babel/pull/9709, but built-ins file was not

In the meantime adding "@babel/preset-env": "7.3.4", to your package.json should do the trick.

Just done a fresh vue create, added this to the dev depdendencies, but still getting:

isPluginRequired is not a function - any ideas?