webpack - ako môžem nastaviť ts-loader, aby sa nepokúšal načítať .html súbory ako TypeScript?
component.ts
import template from './template.html'
vedie k:
TS2307: Cannot find module './template.html' or its corresponding type declarations.
ts-loader-default_e3b0c44298fc1c14
Skúšal som dať raw-loader pred aj za ts-loader, a nič to nezmenilo.
loaders.unshift({
test: /\.html$/,
exclude: /node_modules/,
use: 'raw-loader',
});
Tiež som sa pokúsil urobiť:
component.ts
import template from '!!raw-loader!./template.html'
A to tiež nefunguje.
rozlíšenie stopy zobrazuje:
======== 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. ========
Prečo sa to snaží načítať ako TypeScript alebo JavaScript? Ako mu môžem povedať, aby to nerobilo?