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.

babel not transpiling outside of src directory.

See original GitHub issue

Node version: 6.2.2 npm version: 3.9.5 Operating system: EI Capitan Command line used: npm run build

I’ve used slingshot on a few new projects and it works great. I’m trying to convert a few existing projects that were using browserify and gulp. I think I have everything in place however it is structured a little differently because of the way I was handling code common to multiple app:

common
  … (some common components and utilities shared by all apps
app1
  src/ …
app2
  src/...

So, app1 for example, has some places where it imports code as:

import SomeComponent from '../../../common/compnents/SomeComponent';

And after doing an “npm run build” for app1, it seems that all components imported from the common folder outside of app1/src are not getting transpired by babel. When previously using gulp/browserify, even though I really just wanted to import the source files from common, I’ve found that each of the common components needed to have it’s own package.json (and npm install run) because of the way node resolves imports. I think this may be related… I tried copying the .babelrc to each of the common directories, but that didn’t help.

Any idea? Thanks!

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
raythreecommented, Aug 5, 2016

Thanks, that seems to have done it. I replace the include with exclude:/node_modules/. Each of the common components needed the .babelrc and all was processed.

0reactions
coryhousecommented, Aug 5, 2016

Just committed this change. Thanks! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Babel 7.18 doesn't transpile components outside the project ...
This is contrary to my expectation. Why is the node_modules/sharedlib directory include d, but the files in it are not transpiled? babel.config.
Read more >
[Solved]-node_modules outside of the project directory are not ...
Coding example for the question node_modules outside of the project directory are not transpiled by Babel (7)-Reactjs.
Read more >
Config Files - Babel.js
New in Babel 7.x, Babel has a concept of a "root" directory, which defaults to the current working directory. For project-wide configuration, Babel...
Read more >
babel-loader - webpack
Make sure you are transforming as few files as possible. Because you are probably matching /\.m?js$/ , you might be transforming the node_modules...
Read more >
How To Create A Barebones Production Ready NPM Package ...
Since we will be using babel to transpile it in a later step, we're able to use modern JavaScript ... "start": "npx babel...
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