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.

Not working "Why aren't files in node_modules being transformed?"

See original GitHub issue

Not working: .transform(babelify, { global: true, ignore: [/\/node_modules\/(?!app\/)/] })

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Maxim-Mazurokcommented, Jun 16, 2022

Gentlemen, I believe we all have been deceived by Windows once again. I’ve added some logging and noticed that we have \ instead of / in filename:

babelOpts: {
    ignore: [ /node_modules\/(?!whatwg-fetch)/ ],
    presets: [ [Array] ],
    assumptions: { arrayLikeIsIterable: true },
    sourceType: 'module',
    cwd: 'C:\\Users\\maxim\\browserify-temp',
    caller: { name: 'babelify' },
    filename: 'C:\\Users\\maxim\\browserify-temp\\node_modules\\core-js\\internals\\to-object.js',
    sourceFileName: undefined
  }

So the fix is to make it platform-independent:

ignore: [/[/\\]node_modules[/\\](?!whatwg-fetch[/\\])/],

Hope it helps!

3reactions
TidyLukecommented, Jan 21, 2020

I can’t seem to get this to work at all. The global option no longer works, setting ignores in my gulpfile does not work, removing my config into babel.config.js or babel.config.json does not work. I’m stumped as to how I can transfom a package. Any help would be greatly appreciated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jestjs - `transformIgnorePatterns` not working to include some ...
The answer lies hidden in the documentation (emphasis mine):. If the file path matches any of the patterns, it will not be transformed....
Read more >
How to find out which of my node_modules recently changed?
... just popped up out of nowhere and I needed to determine which of my node_modules recently changed and caused the bug. This...
Read more >
How to transpile node_modules with babel and webpack in a ...
This came with the usual consequences such as onClick functions not working etc. We were naturally concerned about this, and upon investigation ...
Read more >
Node module size: See how I reduced it by 90% | TSH.io
Performance is not a problem for Node.js (unless you accidentally block ... but it quickly turned out that the real problem is node_modules....
Read more >
ts-node - npm
An ignored file can still be executed by node.js. Ignoring a file means we do not transform it from TypeScript into JavaScript, but...
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