webpack can’t parse the webpack module

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

Author: Fantashit

2 thoughts on “webpack can’t parse the webpack module

  1. 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 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 😉). So I think it’s ok that webpack requires the json-loader.

Comments are closed.