fix(build): Fix import of parent chunk's shim (#7398)

In PR #7380 it was suggested[1] that the shims be renamed from
(e.g.) blockly.mjs to blockly.loader.mjs, and in commit 6f930f5
this was duly done, but alas one place was overlooked.

The problem was not spotted in local testing because the
blockly.mjs module that the blocks and generators chunks were
attempting to import did still exist on disk, left over from
before the change was made.

Running npm run clean would have revealed the issue but alas
that was not done.

[1] https://github.com/google/blockly/pull/7380#discussion_r1291667037
This commit is contained in:
Christopher Allen
2023-08-16 16:29:48 +01:00
committed by GitHub
parent bb33531854
commit 51be0760c3

View File

@@ -705,7 +705,9 @@ async function buildShims() {
path.posix.join(RELEASE_DIR, `${chunk.name}${COMPILED_SUFFIX}.js`);
const shimPath = path.join(BUILD_DIR, `${chunk.name}.loader.mjs`);
const parentImport =
chunk.parent ? `import ${quote(`./${chunk.parent.name}.mjs`)};` : '';
chunk.parent ?
`import ${quote(`./${chunk.parent.name}.loader.mjs`)};` :
'';
const exports = await import(`../../${modulePath}`);
await fsPromises.writeFile(shimPath,