Skip to content

Commit

Permalink
fix(remix-dev): allow emitting serverBuildPath as cjs
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <[email protected]>
(cherry picked from commit 63b5e5d)
  • Loading branch information
mcansh committed Sep 6, 2023
1 parent dfc5870 commit 0e2472d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/remix-dev/compiler/server/write.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ import * as fse from "fs-extra";

import type { RemixConfig } from "../../config";

let outputExtensions = [".js", ".mjs", ".cjs"];

export async function write(
config: RemixConfig,
outputFiles: esbuild.OutputFile[]
) {
await fse.ensureDir(path.dirname(config.serverBuildPath));

for (let file of outputFiles) {
if (file.path.endsWith(".js") || file.path.endsWith(".mjs")) {
let extension = path.extname(file.path);
if (outputExtensions.includes(extension)) {
// fix sourceMappingURL to be relative to current path instead of /build
let filename = file.path.substring(file.path.lastIndexOf(path.sep) + 1);
let escapedFilename = filename.replace(/\./g, "\\.");
Expand Down

0 comments on commit 0e2472d

Please sign in to comment.