diff --git a/src/node/build/buildPluginHtml.ts b/src/node/build/buildPluginHtml.ts index 7079a11db61130..00bc165f007c6e 100644 --- a/src/node/build/buildPluginHtml.ts +++ b/src/node/build/buildPluginHtml.ts @@ -1,7 +1,7 @@ import { Plugin, RollupOutput, OutputChunk } from 'rollup' import path from 'path' import fs from 'fs-extra' -import { isExternalUrl, cleanUrl, isStaticAsset } from '../utils/pathUtils' +import { isExternalUrl, cleanUrl } from '../utils/pathUtils' import { resolveAsset } from './buildPluginAsset' import { parse as Parse, @@ -182,8 +182,10 @@ const compileHtml = async ( !isExternalUrl(p.value.content) ) { const url = cleanUrl(p.value.content) - js += `\nimport ${JSON.stringify(url)}` - if (isStaticAsset(url)) { + if (url.endsWith('.css')) { + js += `\nimport ${JSON.stringify(url)}` + s.remove(node.loc.start.offset, node.loc.end.offset) + } else { assetUrls.push(p) } }