'Babel doesn't ignore snapshot folder and files
I'm using the following npm build script with Babel 7;
"build": "rm -rf dist && babel src/lib --out-dir dist --copy-files --no-copy-ignored",
And this is my ignore section in my .babelrc.json file;
"ignore": [
"**/__mocks__",
"**/__snapshots__",
"**/*.snap",
"**/*.test.js"
]
Despite successfully being ignored matched test.js files and __mocks__ folder, __snapshots__ folder and files with .snap extension is not being ignored they're being copied to the dist folder.
Installed devDependencies;
"devDependencies": {
"@babel/cli": "^7.17.0",
"@babel/core": "^7.17.0",
"@babel/preset-env": "^7.16.11",
...
}
Any idea what's wrong?
Solution 1:[1]
I've wasted an inordinate amount of time on this. It is apparently a bug: https://github.com/babel/babel/issues/11394. File that are not considered compilable by babel are not ignored. There is a fix using the --extension flag that allows you to modify what files babel considers compilable.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Steven L. |
