Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

[Bug Report] raw-loader failed to load *.json #91

Description

@ulivz
  • 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:

  1. git clone https://github.com/ulivz/raw-loader-load-json-repro
  2. yarn
  3. npx webpack
  4. You'll got following error:

  1. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions