diff --git a/scripts/build-plugins/rollup-plugin-build-themes.js b/scripts/build-plugins/rollup-plugin-build-themes.js index ef1eb78b..e7a2bb2b 100644 --- a/scripts/build-plugins/rollup-plugin-build-themes.js +++ b/scripts/build-plugins/rollup-plugin-build-themes.js @@ -128,6 +128,11 @@ module.exports = function buildThemes(options) { async load(id) { if (isDevelopment) { + /** + * To load the theme during dev, we need to take a different approach because emitFile is not supported in dev. + * We solve this by resolving virtual file "@theme/name/variant" into the necessary css import. + * This virtual file import is removed when hydrogen is built (see transform hook). + */ if (id.startsWith(resolvedVirtualModuleId)) { let [theme, variant, file] = id.substr(resolvedVirtualModuleId.length).split("/"); if (theme === "default") { @@ -174,11 +179,17 @@ module.exports = function buildThemes(options) { if (isDevelopment) { return; } - // Removes develop-only script tag; this cannot be done in transformIndexHtml hook. - const devScriptTag = /