-
-
Notifications
You must be signed in to change notification settings - Fork 93
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-loader rules ignores additional_paths that come from node_modules #208
Comments
Also if we should write the configuration in the |
@BALOTIAS I think there should be a different configuration of paths that need transpiling inside of node_modules. Is there any reason to overload the meaning of additional_paths? |
@justin808 I wasn't aware that additional_paths does more than simply adding files to webpack to look them up when resolving them. Maybe I misunderstood the docs: https://github.com/shakacode/shakapacker#additional-paths Either way I'm happy for a different configuration of paths or to re-use the same, as long as I can somehow make the node modules transpile with my babel config. :)) Also it would make sense what @vaukalak mentioned. |
@vaukalak just tried it out, works! :D Might make sense to add a node_module path to the documentation example as well :)) |
Ruby version: 3.1.2
Rails version: 7.0.4
Shakapacker version: 6.5.4
Expected behavior:
Directories in
webpacker.yml
additional_paths
should all be transpiled, even if they're insidenode_modules
. Otherwise third-party packages like let's say@hotwired/turbo-rails
might not work for custom browserlist configurations. (I had to support Safari 14, and turbo needed to be transpiled because of this)Actual behavior:
All directories inside
node_modules
are ignored by the babel-loader, even if they're set inadditional_paths
, likenode_modules/@hotwired/turbo-rails
Here's my modified rule, that fixes this (refactor it as you will, also the imports):
The babel-loader rule includes all inclusions and excludes all node_modules by default, besides the ones that are in the inclusions.
Usage:
You can then use
addional_paths
fornode_modules
as well, example:The text was updated successfully, but these errors were encountered: