Open jason-james opened 5 years ago
You need to use babel.config.js instead of .babelrc to compile node_modules
Do you mean the node module itself needs a babel.config.js file or the project that I want to use the module in? If the former, why does it result in an error for the larger project but not the smaller one?
(I deleted my comment in less then a minute, I was too slow? :stuck_out_tongue:)
I meant that it needs to be in the project, but it only works with Babel 7. I don't know how to configure Babel to transpile node_modules with Babel 6.
(I deleted my comment in less then a minute, I was too slow? 😛)
I meant that it needs to be in the project, but it only works with Babel 7. I don't know how to configure Babel to transpile node_modules with Babel 6.
Haha, guess you were! Ah ok. When I updated everything to babel 7 I kept getting an error that it was using loader 6.26.3 no matter what I did so I'll go down that rabbit hole another time...
I got rid of the second error by editing my webpack file like so:
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules\/(?!inferno-chartist)/,
use: {
loader: "babel-loader",
options: JSON.parse(fs.readFileSync("./.babelrc"))
}
}
]
}
};
But the first error is still there. Do you know how I can transpile the package BEFORE installing it my project? Maybe that will fix it?
I'm trying to use a node module I've made in my own project. I am using Inferno, which is essentially a React clone. This module I have made works perfectly fine in a fresh, basic create-inferno-app application, but when installing and trying to use it in my real application, I get import and parse errors. I've been looking at this for so many hours and I just can't figure it out. I've tried a lot of different things.
Here is the package.json of the node module
Here is the package.json of the simple app, which the module works fine with
Here is the package.json for the app which it is not working with
Here is the babelrc file of the app it is not working with:
Here is the error message:
and a little further down...
Sorry for the large code blocks, but I hope someone can help. I can't see what the second app is missing for it not to work.