bundle-loader icon indicating copy to clipboard operation
bundle-loader copied to clipboard

Support json modules

Open rmja opened this issue 7 years ago • 6 comments

This is a proposal for a fix to #74. It is not elegant but it gets the job done. The way the NormalModuleFactory is found from the dependencyFactories is probably not the right way to do it, but I don't have a good enough understanding on how to do this stuff, and this is the proposal I was able to come up with:-)

The example environment that this PR is fixing is: index.js:

require("bundle-loader!./test.json");

test.json:

{ "any": "json file" }

Without this fix, this currently returns the error:

ERROR in ./src/test.json (./node_modules/bundle-loader!./src/test.json) Module parse failed: Unexpected token v in JSON at position 0 while parsing near 'var cbs = [], data...' You may need an appropriate loader to handle this file type.

rmja avatar Jul 04 '18 10:07 rmja

CLA assistant check
All committers have signed the CLA.

jsf-clabot avatar Jul 04 '18 10:07 jsf-clabot

ping. The bug this pr fixes is a showstopper when using json files with webpack 4.

rmja avatar Aug 24 '18 05:08 rmja

Ping @michael-ciniawsky, sorry for the noise - any news on this?

rmja avatar Sep 15 '18 10:09 rmja

I can verify that this PR also fixes the issue for me with no adverse side effects that I notice. Would be great to get this, or an equivalent, merged @michael-ciniawsky

billneff79 avatar Nov 20 '18 23:11 billneff79

This PR also fixed the issue for me. Are there other maintainers than @michael-ciniawsky who could check this pull request?

maksis avatar Feb 18 '19 17:02 maksis

@michael-ciniawsky Could you comment on this? Or maybe point us to someone who would be able to review this?

rmja avatar Jan 29 '20 08:01 rmja