Turn HTML imports (and export from) into strings.
Given the following example.html.
<h1>Hello</h1>
import html from './example.html';
const html = '<h1>Hello</h1>';
and if using export
export * as html from './example.html';
const html = "<h1>Hello</h1>";
export { html };
$ npm install babel-plugin-transform-html-import-to-string
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-html-import-to-string"]
}
$ babel --plugins transform-html-import-to-string script.js
require("babel-core").transform("code", {
plugins: ["transform-html-import-to-string"]
});