# 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
, and it made no difference.
loaders.unshift({
test: /\.html$/,
exclude: /node_modules/,
use: 'raw-loader',
});
I also tried doing:
# component.ts
import template from '!!raw-loader!./template.html'
And that does not work either.
trace resolution shows:
======== Resolving module './heading.html' from 'app/javascript/components/heading/heading.component.ts'. ========
Loading module as file / folder, candidate module location 'app/javascript/components/heading/heading.html', target file type 'TypeScript'.
File 'app/javascript/components/heading/heading.html.ts' does not exist.
File 'app/javascript/components/heading/heading.html.tsx' does not exist.
File 'app/javascript/components/heading/heading.html.d.ts' does not exist.
Directory 'app/javascript/components/heading/heading.html' does not exist, skipping all lookups in it.
Loading module as file / folder, candidate module location 'app/javascript/components/heading/heading.html', target file type 'JavaScript'.
File 'app/javascript/components/heading/heading.html.js' does not exist.
File 'app/javascript/components/heading/heading.html.jsx' does not exist.
Directory 'app/javascript/components/heading/heading.html' does not exist, skipping all lookups in it.
======== Module name './heading.html' was not resolved. ========
Why is it trying to load this as typescript or javascript? How can I tell it to not do that?