3

I am trying to use es6 in my node 14+ app transpiling using babel 7.18.6. I added below build step to my npm script

"build": "babel . --ignore node_modules,.platform --copy-files --no-copy-ignored --delete-dir-on-start --out-dir dist"

But it still copies node_modules and other unnecessary directories in root to the build folder. I've tried different combinations in babel.config.json with ignore block but its still not working.

How to make --copy-files ignore node_modules and other unnecessary directories

Here is my babel.config.json

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "node": "current"
        },
        "useBuiltIns": "usage",
        "corejs": "^3.23.3",
        "debug": false
      }
    ]
  ],
  "ignore": [
    "./node_modules"
  ],
  "targets": {
    "node": "current"
  }
}

Babel packages I'm using in my package.json

"@babel/cli": "^7.18.6",
"@babel/core": "^7.18.6",
"@babel/eslint-parser": "^7.18.2",
"@babel/node": "^7.18.6",
"@babel/preset-env": "^7.18.6",
ajay
  • 328
  • 1
  • 5
  • 17

0 Answers0