Updated to Angular 9 and raw-loader no longer working

Viewed 1524

Just updated to ng 9 and getting the following error when attempting to build:

Cannot find module '!raw-loader!./help/vdpviewsHelp.html'

We've been using raw-loader to load some html files as string and haven't had issues until updating. Has anyone else run into this or can advise on how to get Web-Pack to load html templates as strings again?

Thanks

1 Answers

In angular 9 raw-loader was updated to 4.0.0 version.
I don't know the exact root of your problem, but maybe one of following tips will work for you:

1) import css from '!!raw-loader!./file.txt'; // Adding !! to a request will disable all loaders specified in the configuration - change call for the vdpviewsHelp.html with !! as in documentation for raw-laoder@4.0.0
2) Basically you can install your own version of raw-loader and it will be used. Add it to your package.json devDependencies section:
"raw-loader": "0.5.1" - it is version that worked for me, when I faced this issue.

Related