Skip to content

Commit

Permalink
feat: automatically disable linked mode for vitest (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanPiercey authored May 8, 2023
1 parent 688425f commit d1a0460
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/short-penguins-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@marko/vite": patch
---

Disable linked mode automatically for vitest
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ const thisFile =

export default function markoPlugin(opts: Options = {}): vite.Plugin[] {
let compiler: typeof Compiler;
const { runtimeId, basePathVar, linked = true } = opts;
let { linked = true } = opts;
const { runtimeId, basePathVar } = opts;
const baseConfig: Compiler.Config = {
cache,
runtimeId,
Expand Down Expand Up @@ -194,6 +195,10 @@ export default function markoPlugin(opts: Options = {}): vite.Plugin[] {
`marko-vite-${crypto.createHash("SHA1").update(root).digest("hex")}`
);

if (isTest) {
linked = false;
}

if (linked && !registeredTag) {
// Here we inject either the watchMode vite tag, or the build one.
const transformer = path.resolve(
Expand Down

0 comments on commit d1a0460

Please sign in to comment.