Closed csterritt closed 8 years ago
Fixed!
First, I did:
npm install babel-plugin-add-module-exports --save-dev
Then, set up my web pack.config.json to change the following part from:
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" },
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react']
}
}
]
},
to
module: {
loaders: [
{ test: /\.css$/, loader: "style!css" },
{
test: /\.js$/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react'],
plugins: ["add-module-exports"]
}
}
]
},
Hi @csterritt sorry for long delay in replying, must have missed this! Glad you figured it out but it is strange that you got that issue. Can you check to see if it is still a problem for you and reopen if so?
I had the same issue today. The solution proposed worked for me too
With webpack2 it's inappropriate solution. @see https://gist.github.com/iamakulov/966b91c0fc6363a16ff0650b51fb991b
@danawoodman Will you get rid of this?
@olegstepura it would be an issue I would need to address if I upgrade to WebPack 2 but I don't think it should be an issue for consumers of this library. Am I wrong?
It is an issue. I'm using webpack 2. And after importing anything from this lib I get the error mentioned above. This stops build, I cannot proceed. But I cannot install add-module-exports
since it's incompatible with webpack 2. So ignoring this will only lead to not using this lib.
@olegstepura I am using WebPack 2 and do not get this error. Can you post your WebPack config?
Sure. It's the same as here: https://github.com/olegstepura/postcss-loader-test/blob/master/webpack.config.js
Actually whole config including package.json
is almost the same in that test project.
@olegstepura perhaps you could put together a minimal test case where this fails? That config is a bit complex and hard to know what is triggering the issue
Please read this: https://github.com/brigade/react-waypoint/issues/186
That issue is about the same thing. There is my comment on how it was temporarily solved and how to possibly proceed by library author
So from what I can tell @olegstepura is that you are including react-fontawesome in WebPack. Why not exclude it just as you mentioned in the comment thread?
Because that is not a plug-and-play solution.
@olegstepura It seems typical to me for people to exclude the node_modules folder. In fact, it seems like a best practice to do so otherwise you're parsing all your node_modules which is incredibly slow and unnecessary. I don't see a compelling reason to change the current behavior at this point
@danawoodman Thanks a lot! That was a reasonable comment. I will try to use only compiled versions of all the stuff, excluding node_modules
completely. But I think it will be good for any library including yours to hanle such situations as well (maybe using js:next
)
@olegstepura no problem 👍 I'll consider it in the future as the WebPack 2 landscape changes 😄
I am facing the same error as @csterritt tried the solution proposed by him but still getting the same error..can anyone suggest me what to do resolve the issue?
@Nisharunnisaa you excluded node_modules
folder?
No i didn't excluded node_modules folder but still facing the issue. is There any alternative @danawoodman ? Help me with the solution
Thanks in Advance
Exclude node_modules
and see if that fixes it
Hi -- Thanks for doing this, it looks great.
However, I'm getting the following error when I try to use it:
Any clues appreciated.