Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.42k stars 1.99k forks source link

Error building with calypso build #41148

Open renatho opened 4 years ago

renatho commented 4 years ago

Steps to reproduce

  1. Setup a basic project with only an index.js
  2. My package.json
    {
    "name": "test",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "calypso-build ./index.js"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
    "@automattic/calypso-build": "^6.1.0"
    }
    }
  3. Run npm run build

What I expected

To build correctly.

What happened instead

Receiving this error:

ERROR in ./index.js
Module build failed (from ./node_modules/thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
[BABEL] /my-project-path/test/index.js: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "my-project-path/test/node_modules/@babel/preset-env/lib/index.js")
    at PoolWorker.fromErrorObj (my-project-path/test/node_modules/thread-loader/dist/WorkerPool.js:262:12)
    at getPlugin (my-project-path/test/node_modules/@babel/preset-env/lib/index.js:67:11)
    at Array.from.map.pluginName (my-project-path/test/node_modules/@babel/preset-env/lib/index.js:258:62)
    at Array.map (<anonymous>)
    at _default (my-project-path/test/node_modules/@babel/preset-env/lib/index.js:258:43)
    at /my-project-path/test/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
    at /my-project-path/test/node_modules/@babel/core/lib/config/full.js:199:14
    at Generator.next (<anonymous>)
    at Function.<anonymous> (my-project-path/test/node_modules/@babel/core/lib/gensync-utils/async.js:26:3)
    at Generator.next (<anonymous>)
    at step (my-project-path/test/node_modules/gensync/index.js:254:32)

Context / Source

I was creating a new project using the calypso-build to build. And while running I was getting the error.

I also tested in some projects (Sensei) where we are using it. It's working, but when removing the package-lock.json the error appears too.

Here are some discussions with possible workarounds: https://stackoverflow.com/questions/60780664/could-not-find-plugin-proposal-numeric-separator

dogfooding