Skip to content

Commit

Permalink
fix: avoid using virtual modules for builtin types
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey committed Nov 20, 2023
1 parent 03143ae commit 798c045
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-pigs-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"arc-vite": patch
---

Avoid checking for virtual adaptive modules when processing files known to be handled by Vite.
4 changes: 4 additions & 0 deletions src/utils/virtual-matches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { getMatches, type Match } from "./matches";

const arcPrefix = "\0arc-";
const arcVirtualMatchPrefix = `${arcPrefix}match:`;
const isBuiltinModuleType =
/\.(?:[mc]?[tj]s|json|css|less|sass|scss|styl|stylus|pcss|postcss|sss)(\?|$)/;

export async function getVirtualMatches(
ctx: Rollup.PluginContext,
Expand All @@ -18,6 +20,8 @@ export async function getVirtualMatches(
if (matches) return matches;
}

if (isBuiltinModuleType.test(id)) return;

const { meta } = await ctx.load(resolved);
if (Array.isArray(meta.arcScanIds)) {
if (typeof meta.arcSourceCode !== "string") {
Expand Down

0 comments on commit 798c045

Please sign in to comment.