webpack-contrib / json-loader

json loader module for webpack - UNMAINTAINED

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

webpack v4 - compatibility

deleonio opened this issue · comments

thx

webpack >= v2.0.0 has 'native'/direct JSON support. Since webpack >= v4.0.0 it's a module.type (no JS wrapper needed anymore). You can remove the json-loader from your setup. Otherwise please provide more info about what 'compatibility' exactly means here :).

⚠️ It's possible the json-loader causes issue with webpack >= v4.0.0, because the loader issues a JS Module (module.type = 'javascript/auto'), which isn't needed anymore/doesn't work with module.type = 'json' (JSONParser) by default

This (removing json-loader) fixed an issue I was having with webpack throwing errors about Unexpected token in package.jsons.

@zjr I will add a note to the README when I have a few minutes :)

@michael-ciniawsky removing the loader works. Thank you all.

Is there a possibility to override the webpack-builtin json-loader? I have my own and it looks like the output of mine is being fed into json-loader (which then errors out, because my loader returns JS code, not JSON code)