-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
babel not transpiling outside of src directory. #224
Comments
I know this doesn't directly answer your question, but why not package shared code as an npm package? |
Actually since each of the common folders needs their own package.json/deps just to import them, I may as well put a "build" in their package.json that runs babel src -> lib (just the way you do when publishing an npm package) |
Ah, you answered as I was typing... yeah, this is a private repo, so we'd have to use private npm, but same idea. Thanks! |
I am still curious though why they didn't get transpired, as they were linked in through the entry point. |
I believe it's this line from the dev and prod webpack configs: https://github.com/coryhouse/react-slingshot/blob/master/webpack.config.prod.js#L68 Try taking that out and see if you're all set. That said, I can't recall why that's there at all. I believe it's just a performance optimization to assure webpack doesn't try to transpile anything outside of src, but really, the app's entry point dictates what gets transpiled so I suspect we can just remove that snippet. |
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. |
Excellent! |
…les instead of including /src path. This resolves issue #224.
Just committed this change. Thanks! 👍 |
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:
So, app1 for example, has some places where it imports code as:
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!
The text was updated successfully, but these errors were encountered: