diff --git a/package.json b/package.json index 6fdcb03c..5a0c5900 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,7 @@ "sinon": "^15" }, "exports": { - ".": "./src/browser/index.js", - "./pause.js": "./src/server/pause.js" + ".": "./src/browser/index.js" }, "files": [ "/src" diff --git a/src/server/headed-mode-plugin.js b/src/server/headed-mode-plugin.js index f1fe755f..82936038 100644 --- a/src/server/headed-mode-plugin.js +++ b/src/server/headed-mode-plugin.js @@ -1,3 +1,4 @@ +import { dirname, join, normalize } from 'node:path'; import { globSync } from 'glob'; export function headedMode({ open, watch, pattern }) { @@ -9,9 +10,11 @@ export function headedMode({ open, watch, pattern }) { return { name: 'brightspace-headed-mode', async transform(context) { + if ((watch || open) && files.includes(context.path.slice(1))) { await delay(0); - return `debugger;\nimport '@brightspace-ui/testing/pause.js';\n${context.body}`; + const pausePath = normalize(join(dirname(import.meta.url), 'pause.js')); + return `debugger;\nimport '${pausePath}'\n${context.body}`; } } };