Questions tagged [raw-loader]
40 questions
2
votes
0 answers
Module not found: Error: Can't resolve 'raw-loader'
Let me start by saying I realize this isn't specifically an issue with ngx-bootstrap and definitely goes above and beyond the call if anyone ends up being nice enough to help me out, but here's the situation:
A few years ago, we created our own…

Chaz Sroczynski
- 21
- 3
2
votes
0 answers
how can I make ts-loader not try to load .html files as typescript?
# component.ts
import template from './template.html'
results in:
TS2307: Cannot find module './template.html' or its corresponding type declarations.
ts-loader-default_e3b0c44298fc1c14
I tried putting raw-loader before and after ts-loader,…

patrick
- 9,290
- 13
- 61
- 112
2
votes
1 answer
Import SCSS as string
I'm trying to import some SCSS into a Javascript file with mixed results. I've found that this works:
style.styleString.scss
body {
background: #556;
}
.test {
&__child {
color: red;
}
}
index.js
import "./index.style"; //…

Sandy Gifford
- 7,219
- 3
- 35
- 65
2
votes
1 answer
Requiring json file with raw-loader causes a syntax error
When I do require("!!raw-loader!themes/builtin_themes/default/layout.json"), I get the following error:
Module parse failed: Unexpected token m in JSON at position 0 while parsing near 'module.exports = "{\...'
File was processed with these…

bigblind
- 12,539
- 14
- 68
- 123
2
votes
0 answers
Dynamic import text files in webpack
Typically when we need to import some raw string we use raw-loader. The common use case is the following:
In the source code we add:
let data = (await import(/* webpackChunkName: "a.txt" */"./a.txt")).default;
console.log(a.default)
Will…

deathangel908
- 8,601
- 8
- 47
- 81
2
votes
1 answer
ReactJS react-app-rewired / config-overrides for raw-loader not working
I'd like to use the raw-loader in my react js project.
I'm using the react-app-rewired lib and a config-overrides.js.
When I import the file, I'm hoping to receive the contents of it.
Instead, I'm receiving the path to the file.
App.js
import…

Larry K
- 47,808
- 15
- 87
- 140
2
votes
1 answer
How to load a file on component mounting using React w/ raw-loader
I'm currently loading Markdown files using raw-loader.
webpack.config.dev.js
rules: [
...
{
oneOf: [
...
{test: /\.md$/, use: 'raw-loader'},
...
],
},
],
Other than setting a map of renderers, the Page component…

Mathieu Marques
- 1,678
- 15
- 33
2
votes
1 answer
How to override a webpack loader based on specific require needs?
I'm building a documentation site in which I want to display demo code snippets.
With the styles, it was really straight forward, as my app is only including the main.scss, so I'm processing that file with all the necessary loaders to compile it,…

Marcos Mellado
- 125
- 2
- 11
1
vote
0 answers
raw-loader and vue3 - dependency was not found
I want to import a .md file as text in my vue3 component. Like this
import test from "!raw-loader!./assets/test.md";
And I'm using (as you can see) raw-loader.
I also have this in my vue.config.js file:
module.exports = {
chainWebpack: (config)…

Lorenzo Andreasi
- 151
- 1
- 1
- 10
1
vote
0 answers
Raw SVG using raw-loader, keep getting inline SVG
I'm trying to display raw svg in the Vue component using raw-loader.
However, the svg is always inlined no matter what I do. Here's my code: