Help with inline import json-schema-ref-loader
See original GitHub issueHi,
I have an issue when importing json using json-schema-ref-loader, this is most likely NOT json-schema-ref-loader issue but will appreciate if anyone can see what I’m missing…
So my import is like
import MySchema from '@cloudflare/json-schema-ref-loader!./my-schema.json';
And I get the following error when running webpack:
Module parse failed: Unexpected token m in JSON at position 0 while parsing near 'module.exports ...
I assumed this is because there is some other loader who tries to parse the json after json-schema-ref-loader loaded it, so I prefixed the loader with !!
which should disable all configured loaders:
import MySchema from '!!@cloudflare/json-schema-ref-loader!./my-schema.json';
But still no luck 😦
If I change the file extension from json -> jjj
the following works:
import MySchema from '@cloudflare/json-schema-ref-loader!./my-schema.jjj';
Any ideas how I can resolve this? Thx!
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
Oh, I see- it’s outputting JavaScript which is now a problem. One day it will be possible to do things in JS without stacking a bajillion constantly changing frameworks on top of each other. Maybe.
OK, so to close this issue, this is what I ended up with:
.schema.json
This way
json-schema-ref-loader
will only handle my schema files and webpack will keep handling regularjson
files…Thx 😃