Set custom exclude string for babel
See original GitHub issue- Laravel Mix Version: 1.6.1
Description:
My project does have npm dependencies like this: "phoenix": "file:../deps/phoenix". No matter what I set in the .babelrc as ignored folders, webpack seems to try to run babel on those dependencies, which results in the following error:
ERROR in ../deps/phoenix_html/priv/static/phoenix_html.js
Module build failed: ReferenceError: Unknown plugin "transform-object-rest-spread" specified in "base" at 0, attempted to resolve relative to "../deps/phoenix_html/priv/static"
Excluding the folder in the webpack-rules.js does solve the issue, but I’d rather edit that from within the webpack.mix.js.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Set custom exclude string for babel · Issue #1327 - GitHub
You can do this by creating your own custom .babelrc file. It'll then be merged with Mix's at runtime.
Read more >Options - Babel.js
Some plugins may require the presence of the filename. Options like "test" , "exclude" , and "ignore" require the filename for string/RegExp matching....
Read more >Make babel exclude test files - node.js - Stack Overflow
Based on the documentation, you should be able to write .babelrc { "ignore": [ "**/*.test.js" ] }. However, I was able to verify...
Read more >babel-loader - webpack
cacheIdentifier : Default is a string composed by the @babel/core 's ... This can be set to a custom value to force cache...
Read more >babel-loader-exclude-node-modules-except - Yarn
Creating a regular expression for excluding node_modules from babel transpiling except for individual modules. webpack, babel-loader, exclude, node_modules ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Just in case this helps anyone else in the future, I had the same problem and could not solve it with a custom .babelrc file with ignored folders or files. The solution that worked for me was to set the resolve.symlinks config option to false in my project’s webpack.mix.js file, as shown below.
mix.webpackConfig({ resolve: { symlinks: false } })@michaeljoyner solution worked for me too, thanks!
https://webpack.js.org/configuration/resolve/#resolve-symlinks