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

raw-loader returns export string instead of file content #108

Open
FelixSab opened this issue Feb 23, 2021 · 1 comment
Open

raw-loader returns export string instead of file content #108

FelixSab opened this issue Feb 23, 2021 · 1 comment

Comments

@FelixSab
Copy link

FelixSab commented Feb 23, 2021

  • Operating System: Ubuntu:16.04
  • Node Version: 14.15.5
  • Yarn Version: 1.22.5
  • webpack Version: 5.24.0
  • raw-loader Version: ^4.0.2

Expected Behavior

Content of the file should be imported

Actual Behavior

a string like export default __webpack_public_path__ + "$test.10d9aaad.txt"; is imported

Code

import test from './test.txt';

console.log({ test }); // should return 'hello, world' but returns mentioned above string

How Do We Reproduce?

I will add that later, when I have successfully reproduced the issue on a small repo

edit: https://github.com/FelixSab/raw-loader-issue

install the npm packages and execute yarn start / npm run start. The result is shown in the console

@alexander-akait
Copy link
Member

It means you use file-loader instead raw-loader for this file, anyway file-loader/url-loader/raw-loader is deprecated for webpack v5, please migrate on https://webpack.js.org/guides/asset-modules/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants