Skip to content

Commit af1893f

Browse files
author
Ives van Hoorne
committed
Fix module view
1 parent 9ab5b66 commit af1893f

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/app/src/sandbox/boilerplates/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ export function findBoilerplate(module: Module): any {
3131
const boilerplates = getBoilerplates();
3232
const boilerplate = boilerplates.find(b => {
3333
const regex = new RegExp(b.condition);
34-
return regex.test(module.title);
34+
return regex.test(module.path);
3535
});
3636

3737
if (boilerplate == null) {
3838
throw new Error(
3939
`No boilerplate found for ${
40-
module.title
40+
module.path
4141
}, you can create one in the future`
4242
);
4343
}

packages/app/src/sandbox/compile.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,14 @@ async function compile({
158158
debug(`Evaluation time: ${Date.now() - tt}ms`);
159159
const domChanged = oldHTML !== document.body.innerHTML;
160160

161-
if (isModuleView && !domChanged && !module.title.endsWith('.html')) {
162-
const isReact = module.code && module.code.includes('React');
161+
if (
162+
isModuleView &&
163+
!domChanged &&
164+
!managerModuleToTranspile.path.endsWith('.html')
165+
) {
166+
const isReact =
167+
managerModuleToTranspile.code &&
168+
managerModuleToTranspile.code.includes('React');
163169

164170
if (isReact) {
165171
// initiate boilerplates
@@ -171,7 +177,7 @@ async function compile({
171177
}
172178
}
173179

174-
const boilerplate = findBoilerplate(module);
180+
const boilerplate = findBoilerplate(managerModuleToTranspile);
175181
if (boilerplate) {
176182
try {
177183
boilerplate.module.default(evalled);

0 commit comments

Comments
 (0)