From 54b09129625edc4b3b11170c7cfd140f6dc04254 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Thu, 13 Jul 2023 13:32:42 -0400 Subject: [PATCH] Import pause.js directly --- package.json | 3 +-- src/server/headed-mode-plugin.js | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) 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..c5dfdef3 100644 --- a/src/server/headed-mode-plugin.js +++ b/src/server/headed-mode-plugin.js @@ -1,3 +1,4 @@ +import { dirname, join } 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 = join(dirname(import.meta.url), 'pause.js').replace('file:', ''); + return `debugger;\nimport '${pausePath}'\n${context.body}`; } } };