This repository was archived by the owner on Mar 17, 2021. It is now read-only.
Description
Operating System: OSX
Node Version: v12.16.1
NPM Version: 6.13.4
webpack Version: 4.42.1
raw-loader Version: 4.0.1
Expected Behavior
*.json should be loaded successfully with raw-loader like the *.js;
Actual Behavior
*.json cannot be loaded successfully.
Code
import foo from 'raw-loader!./foo.json' // don't work
// import foo from 'raw-loader!./foo.js' // work
export default {
foo,
}
How Do We Reproduce?
I just created a minimal reproduction repo: raw-loader-load-json-repro , and here're the reproduction steps:
git clone https://github.com/ulivz/raw-loader-load-json-repro
yarn
npx webpack
You'll got following error:
Modify entry index.js,comment json import and uncomment js import:
- import foo from 'raw-loader!./foo.json' // don't work
+ // import foo from 'raw-loader!./foo.json' // don't work
- // import foo from 'raw-loader!./foo.js' // work
+ import foo from 'raw-loader!./foo.js'
export default {
foo,
}
Ru-run npx webpack,the build will be success.
Reactions are currently unavailable
Expected Behavior
*.jsonshould be loaded successfully with raw-loader like the*.js;Actual Behavior
*.jsoncannot be loaded successfully.Code
How Do We Reproduce?
I just created a minimal reproduction repo: raw-loader-load-json-repro, and here're the reproduction steps:
git clone https://github.com/ulivz/raw-loader-load-json-reproyarnnpx webpackindex.js,commentjsonimport and uncommentjsimport:Ru-run
npx webpack,the build will be success.