-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
webpack can't parse the webpack module #184
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
Comments
You need the json-loader. Here is webpack compiled by webpack for the browser: http://webpack.github.io/playground/ |
@sokra Oh man. That's sweet! |
I'm confused, why would I need the json-loader to build a bundle that requires webpack? Node.js doesn't require any json-loader to run scripts using the webpack api, right? That demo is pretty sweet - you should definitely put that front and center on the documentation webpage, and in the git readme. Those really help people decide to use something. |
node.js can load see webpack/docs#5. The problem is that the playground are not full featured. No chunks, because of the way the iframe is injected. No custom loaders. |
So it can, another reason to make the json-loader come standard in webpack I think. |
Well, there are two concepts clashing 😄 . node loads json files out of the box, webpack requires a loader for everything that is not pure JavaScript. I think node loads json files because node doesn't know anything about loaders. They decided to leave it out after having burned their fingers with |
As a matter of fact, JSON is pure javascript, as javascript recognizes it verbatim. In my opinion, reducing the impedance mismatch of web vs node.js is the paramount problem webpack solves, and reducing that mismatch to 0 should be the goal. : ) |
Anyway, I would be ok with both solutions. 😄 |
My vote is to make this work by default if encountered in an npm package:
so I'm with fresheneesz. I also don't feel strongly though, and think both are okay. |
clever warning for module parse errors. #184
I added I will not make the json-loader default for three reasons:
|
Does it mean that I can |
This means |
@sokra Even though late post here, I can't get it working without adding |
I don't know if this is expected or not - its not really something i intended, but i thought i'd report it anyway. I had a
require('webpack')
in the script i was bundling, and when bundling got this:The text was updated successfully, but these errors were encountered: