Skip to content

Commit 1ae4040

Browse files
authored
Add ECMAScript locale modules (#6459)
1 parent 26136c0 commit 1ae4040

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/cli/src/build.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ export const buildLocale = async (opts: BuildOptions = {}) => {
5252
const babelOpts = { ...babelConfig(buildWebpackArgs(opts) as any) };
5353
fs.readdirSync(localDst).forEach((file) => {
5454
const filePath = `${localDst}/${file}`;
55+
const esModuleFileName = filePath.replace(/\.[^.]+$/, '.mjs');
56+
fs.copyFileSync(filePath, esModuleFileName);
5557
const compiled = transformFileSync(filePath, babelOpts).code;
5658
fs.writeFileSync(filePath, compiled);
5759
});
5860

61+
// Remove the index.mjs as it is useless
62+
fs.unlinkSync(`${localDst}/index.mjs`);
63+
5964
printRow('Locale files building completed successfully!');
6065
};
6166

0 commit comments

Comments
 (0)