mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Fix css asset resolution as part of package resolution.
This commit is contained in:
1 parent
ca1d73be11
commit
a03d3c2e31
1 file changed
+5
-1
@@ -111,7 +111,11 @@ export function esmPlugin(packageLock: PackageLock, target?: string): Plugin {
|
||||
// Handle relative or absolute imports inside esm.sh modules
|
||||
build.onResolve({ filter: /.*/, namespace: "esm" }, async (args) => {
|
||||
// Check if this is a bare package import (not a relative path)
|
||||
if (!args.path.startsWith("./") && !args.path.startsWith("../") && !args.path.startsWith("/")) {
|
||||
// Note: CSS assets and some other relative imports don't use ./ prefix
|
||||
const isLikelyAsset = /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|ico|webp|avif)$/i.test(args.path);
|
||||
const isRelativePath = args.path.startsWith("./") || args.path.startsWith("../") || args.path.startsWith("/") || isLikelyAsset;
|
||||
|
||||
if (!isRelativePath) {
|
||||
try {
|
||||
// This is a bare import like "@emotion/is-prop-valid" - treat it as a new package
|
||||
const packageName = args.path.startsWith("@")
|
||||
|
||||
Reference in new issue
Block a user