question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

42reactions
michaeljoynercommented, Dec 17, 2017

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 } })

0reactions
drybpcommented, Jan 23, 2019
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found