mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-29 14:56:36 +03:00
Write compiled Elm CLI output with .cjs extension to make it compatible with "type": "module" in package.json file.
This commit is contained in:
parent
e835b494c9
commit
645dd4e5dd
@ -83,7 +83,7 @@ function _HtmlAsJson_toJson(html) {
|
||||
`;
|
||||
|
||||
await fsPromises.writeFile(
|
||||
readFrom,
|
||||
readFrom.replace(/\.js$/, ".cjs"),
|
||||
elmFileContent
|
||||
.replace(
|
||||
/return \$elm\$json\$Json\$Encode\$string\(.REPLACE_ME_WITH_JSON_STRINGIFY.\)/g,
|
||||
|
@ -4,7 +4,6 @@ import * as fs from "./dir-helpers.js";
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
import { stat } from "fs/promises";
|
||||
import { parentPort, threadId, workerData } from "worker_threads";
|
||||
const compiledElmPath = path.join(process.cwd(), "elm-stuff/elm-pages/elm.js");
|
||||
|
||||
async function run({ mode, pathname, serverRequest, portsFilePath }) {
|
||||
console.time(`${threadId} ${pathname}`);
|
||||
@ -42,6 +41,10 @@ async function run({ mode, pathname, serverRequest, portsFilePath }) {
|
||||
}
|
||||
|
||||
async function requireElm(mode) {
|
||||
const compiledElmPath = path.join(
|
||||
process.cwd(),
|
||||
"elm-stuff/elm-pages/elm.cjs"
|
||||
);
|
||||
let elmImportPath = compiledElmPath;
|
||||
const warnOriginal = console.warn;
|
||||
console.warn = function () {};
|
||||
|
Loading…
Reference in New Issue
Block a user