How do I allow a package in node_modules to be processed by babel?
brandoncc opened this issue · 1 comments
brandoncc commented
Hello,
I posted in the webpacker forum but I haven't gotten any responses, so I am trying here (I realize that it has been asked for us to use the forum, but I really need an answer, sorry).
I need to process one package with babel. The docs talk about a node_modules loader, but it isn't present in the gem anymore. How do I allow babel to process @react-spring
? This is how I used to do it (webacker 3):
const babelLoader = environment.loaders.get('babel');
const babelLoaderUsed = babelLoader.use.find(
(el) => el.loader === 'babel-loader'
);
babelLoader.test = /\.(js|jsx|ts|tsx)?(\.erb)?$/;
babelLoader.exclude = /node_modules\/(?!(@react-spring)\/).*/;
Thanks!
msencenb commented
@brandoncc Do you mind posting how you got this to work? Running into the same issue here.