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