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:
../~/webpack/package.json
Module parse failed: F:\<omitted>\node_modules\webpack\package.json Line 2: Unexpected token :
| {
| "name": "webpack",
| "version": "1.0.1",
| "author": {
@ ../~/webpack/lib/Stats.js 77:11-37
You need the json-loader.
Here is webpack compiled by webpack for the browser: http://webpack.github.io/playground/
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😉 ). So I think it’s ok that webpack requires the json-loader.
require.extensions
. But webpack has a powerful loader mechanism which should imho be used for every file that is not pure JavaScript (and, well, JSON is not actually JavaScript