raw-loader
raw-loader copied to clipboard
raw-loader returns export string instead of file content
- 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
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/