Typescript doesn't remove this special rule "!text" while transpiling into js file for some reason, (even with moduleResolution set to "node")
![transpiled js file](https://i.stack.imgur.com/VoooV.jpg)
thus it causes file path resolve failed. (tested with typescript v2.2.1, node.js v6.9.5)
The documents need an update.
Here is a workable version by add custom file extensions:
index.d.ts
declare module "*.html" {
const value: string;
export default value;
}
Extend nodejs module extensions to read *.html into pure text
require.extensions['.html'] = function(module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
}
And from your example it should works this way:
import * as layout from "./js/views/layouts/wnd.html";
console.log(layout);
If you need to know more about React, Its recommended to join React JS Online Course today.