fix: lang file imports (#8179)

This commit is contained in:
Beka Westberg
2024-05-28 17:01:50 +00:00
committed by GitHub
parent 98958f3a50
commit 933e210037

View File

@@ -677,12 +677,13 @@ async function buildLangfileShims() {
// its named exports.
const cjsPath = `./${lang}.js`;
const wrapperPath = path.join(RELEASE_DIR, 'msg', `${lang}.mjs`);
const safeLang = lang.replace(/-/g, '_');
await fsPromises.writeFile(wrapperPath,
`import ${lang} from '${cjsPath}';
`import ${safeLang} from '${cjsPath}';
export const {
${exportedNames.map((name) => ` ${name},`).join('\n')}
} = ${lang};
} = ${safeLang};
`);
}));
}