Babel does not ignore the node_modules directory, although it is in the "ignore" configuration

For some reason, it babeldoes not ignore the directory node_modules, although I specified it in the "ignore"file field .babelrc. Why is this happening? How to do babelas expected?

My goal is to compress and cripple all the files .jsin my ExpressJS application (especially my entire end code) before I push my application to the remote repo and then to the server. Therefore, I use babeland babili.

Here is my .babelrcconfig:

{
    "presets": [
        ["latest", {
            "modules": false
        }]
    ],
    "env": {
        "development": {
            "presets": ["stage-0", "react", "babili"]
        },
        "production": {
            "presets": ["stage-0", "react", "babili"]
        }
    },
    "ignore": [
        "node_modules",
        "assets",
        "view",
        "public",
        "test",
        "spec",
        "logs",
        "lib/jasmine_examples",
        "db"
    ]
}

And I run babelfrom the command line as follows:

./node_modules/.bin/babel . -d ~/app_compressed/

And babalbegins to compress the directory node_modules:

node_modules\apache-crypt\gensrc\index.js -> C:\Users\user\app_compressed\node_modules\apache-crypt\gensrc\index.js
node_modules\apache-md5\gensrc\index.js -> C:\Users\user\app_compressed\node_modules\apache-md5\gensrc\index.js
node_modules\babel-preset-env\data\built-in-features.js -> C:\Users\user\app_compressed\node_modules\babel-preset-env\data\built-in-features.js
node_modules\babel-preset-env\data\plugin-features.js -> C:\Users\user\app_compressed\node_modules\babel-preset-env\data\plugin-features.js
node_modules\babel-preset-env\lib\default-includes.js -> C:\Users\user\app_compressed\node_modules\babel-preset-env\lib\default-includes.js
node_modules\babel-preset-env\lib\index.js -> C:\Users\user\app_compressed\node_modules\babel-preset-env\lib\index.js

. ? babel , config?

+6
3

Babel , , ingnored .

, ( --ignored), , . globs , **/drafts drafts

./node_modules/.bin/babel . -d ~/app_compressed/ --ignore node_modules,test,assets,stuff,views,public,test,spec,logs,lib/jasmine_examples,db,routes/api/drafts,**/drafts
+5

,

ignore: [
 /node_modules/,
 ...,
]

,

ignore: [
   /node_modukes/,
   function(filepath) {
      return filepath !== "/path/to/es6-file.js";
   },
]
+5

I had the same problem after moving the project Vuefrom Cloud9env to my PC and installing the dependencies npm.

Solved this by:

  1. Update Node.jsusing nvm for Windows
  2. install Vue CLIglobally and then run buildin Vue UI.

I'm not sure what helped though.

0
source

Source: https://habr.com/ru/post/1673022/


All Articles