webpack icon indicating copy to clipboard operation
webpack copied to clipboard

Why isn't json-loader enabled by default?

Open mik01aj opened this issue 10 years ago • 5 comments

I'm coming from https://github.com/fb55/entities/pull/26. It's a commonly used tiny library, and the fact that it uses JSON files internally (which is fine with both Node and Browserify) requires anyone using libraries that use libraries that depend on entities add the json loader explicitly to their webpack config. I wonder why JSON files aren't handled correctly by default.

@sokra , could you please explain this design decision? Would you accept a PR changing this?

mik01aj avatar Apr 21 '16 11:04 mik01aj

I can confirm this is annoying. I believe BitcoinJS also uses JSON files, which is why I had to enable it in my project (even though other things such as Browserify seem to support it by default)

Someguy123 avatar Apr 23 '16 23:04 Someguy123

@webpack, @sokra any feedback?

mik01aj avatar Jun 03 '16 12:06 mik01aj

https://github.com/webpack/webpack/issues/184#issuecomment-36607967

agundermann avatar Jun 03 '16 14:06 agundermann

Seems to me like the reasons @sokra listed in #184 are legit and wont change so this should probably be closed.

kentcdodds avatar Jun 14 '16 16:06 kentcdodds

seems so, yes.

For the record:

I will not make the json-loader default for three reasons:

  • It's not backward-compatible: This means it will break all applications that use json files...
  • It would be impossible/difficult/hard to understand to use another loader for json files. I. e. the json5-loader.
  • It's weird/hard to understand to make all loaders explicit and only the json-loader is default.

mik01aj avatar Jun 15 '16 08:06 mik01aj