From 424e6a0d7e66a742c93acab854092f56f8409830 Mon Sep 17 00:00:00 2001 From: Austin McGee <947888+amcgee@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:49:34 +0100 Subject: [PATCH] fix: normalize to .js extensions when compiling libraries --- cli/src/lib/compiler/compile.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/src/lib/compiler/compile.js b/cli/src/lib/compiler/compile.js index e6204dd2..24f1f7b1 100644 --- a/cli/src/lib/compiler/compile.js +++ b/cli/src/lib/compiler/compile.js @@ -10,7 +10,7 @@ const { createAppEntrypointWrapper, createPluginEntrypointWrapper, } = require('./entrypoints.js') -const { extensionPattern } = require('./extensionHelpers.js') +const { extensionPattern, normalizeExtension } = require('./extensionHelpers.js') const watchFiles = ({ inputDir, outputDir, processFileCallback, watch }) => { const compileFile = async (source) => { @@ -106,7 +106,11 @@ const compile = async ({ source, babelConfig ) - await fs.writeFile(destination, result.code) + + // Always write .js files + const jsDestination = normalizeExtension(destination) + + await fs.writeFile(jsDestination, result.code) } catch (err) { reporter.dumpErr(err) reporter.error(