Try optimized build.

This commit is contained in:
Dillon Kearns 2022-03-31 09:51:12 -07:00
parent ab8a8a4f3c
commit c8ff9e0ca1
2 changed files with 13 additions and 14 deletions

View File

@ -5,7 +5,7 @@
"scripts": {
"start": "elm-pages dev",
"serve": "npm run build && http-server ./dist -a localhost -p 3000 -c-1",
"build": "elm-pages build --debug --keep-cache",
"build": "elm-pages build --keep-cache",
"generate:tailwind": "elm-tailwind-modules --dir ./gen --tailwind-config tailwind.config.js",
"generate:graphql": "elm-graphql https://graphql.us.fauna.com/graphql --header 'authorization: Basic Zm5BRWNiaVRsWkFBU2N4Wk5KYVUxMDk3TjhMSmFDdXlfc1g3ZjZkTTpFbG1QYWdlc1RvZG86YWRtaW4=' --output gen"
},
@ -23,4 +23,4 @@
"postcss": "^8.4.5",
"tailwindcss": "^2.2.19"
}
}
}

View File

@ -345,18 +345,17 @@ async function spawnElmMake(options, elmEntrypointPath, outputPath, cwd) {
if (!options.debug) {
await elmOptimizeLevel2(outputPath, cwd);
}
await fsPromises.writeFile(
outputPath,
(
await fsPromises.readFile(outputPath, "utf-8")
).replace(
/return \$elm\$json\$Json\$Encode\$string\(.REPLACE_ME_WITH_FORM_TO_STRING.\)/g,
"let appendSubmitter = (myFormData, event) => { event.submitter && event.submitter.name && event.submitter.name.length > 0 ? myFormData.append(event.submitter.name, event.submitter.value) : myFormData; return myFormData }; return " +
(options.debug
? "_Json_wrap([...(appendSubmitter(new FormData(_Json_unwrap(event).target), _Json_unwrap(event)))])"
: "[...(new FormData(event.target))")
)
);
// await fsPromises.writeFile(
// outputPath,
// await fsPromises.readFile(outputPath, "utf-8")
// );
// .replace(
// /return \$elm\$json\$Json\$Encode\$string\(.REPLACE_ME_WITH_FORM_TO_STRING.\)/g,
// "let appendSubmitter = (myFormData, event) => { event.submitter && event.submitter.name && event.submitter.name.length > 0 ? myFormData.append(event.submitter.name, event.submitter.value) : myFormData; return myFormData }; return " +
// (options.debug
// ? "_Json_wrap([...(appendSubmitter(new FormData(_Json_unwrap(event).target), _Json_unwrap(event)))])"
// : "[...(new FormData(event.target))")
// )
}
function runElmMake(options, elmEntrypointPath, outputPath, cwd) {