Skip to content

Commit

Permalink
Import pause.js directly
Browse files Browse the repository at this point in the history
  • Loading branch information
bearfriend committed Jul 13, 2023
1 parent 734d226 commit 60d929d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
"sinon": "^15"
},
"exports": {
".": "./src/browser/index.js",
"./pause.js": "./src/server/pause.js"
".": "./src/browser/index.js"
},
"files": [
"/src"
Expand Down
5 changes: 4 additions & 1 deletion src/server/headed-mode-plugin.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { dirname, join, normalize } from 'node:path';
import { globSync } from 'glob';

export function headedMode({ open, watch, pattern }) {
Expand All @@ -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}`;
}
}
};
Expand Down

0 comments on commit 60d929d

Please sign in to comment.