mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 23:12:22 +03:00
Try using esbuild bundle option.
This commit is contained in:
parent
bdc1715726
commit
343b30bc3a
@ -138,15 +138,15 @@ async function run(options) {
|
||||
const portDataSourceCompiled = esbuild
|
||||
.build({
|
||||
entryPoints: ["./port-data-source"],
|
||||
outfile: ".elm-pages/compiled-ports/port-data-source.mjs",
|
||||
platform: "node",
|
||||
outfile: ".elm-pages/compiled-ports/port-data-source.js",
|
||||
assetNames: "[name]-[hash]",
|
||||
chunkNames: "chunks/[name]-[hash]",
|
||||
outExtension: { ".js": ".mjs" },
|
||||
|
||||
outExtension: { ".js": ".js" },
|
||||
metafile: true,
|
||||
bundle: false,
|
||||
bundle: true,
|
||||
watch: false,
|
||||
logLevel: "silent",
|
||||
logLevel: "error",
|
||||
})
|
||||
.then((result) => {
|
||||
global.portsFilePath = Object.keys(result.metafile.outputs)[0];
|
||||
|
@ -140,15 +140,15 @@ async function start(options) {
|
||||
.build({
|
||||
entryPoints: ["./port-data-source"],
|
||||
entryNames: "[dir]/[name]-[hash]",
|
||||
|
||||
platform: "node",
|
||||
outdir: ".elm-pages/compiled-ports",
|
||||
assetNames: "[name]-[hash]",
|
||||
chunkNames: "chunks/[name]-[hash]",
|
||||
outExtension: { ".js": ".mjs" },
|
||||
logLevel: "silent",
|
||||
outExtension: { ".js": ".js" },
|
||||
logLevel: "error",
|
||||
|
||||
metafile: true,
|
||||
bundle: false,
|
||||
bundle: true,
|
||||
watch: true,
|
||||
plugins: [
|
||||
{
|
||||
|
@ -45,7 +45,7 @@ function lookupOrPerform(portsFile, mode, rawRequest, hasFsAccess) {
|
||||
const { fs } = require("./request-cache-fs.js")(hasFsAccess);
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const request = toRequest(rawRequest);
|
||||
const portsHash = (portsFile && portsFile.match(/-([^-]+)\.mjs$/)[1]) || "";
|
||||
const portsHash = (portsFile && portsFile.match(/-([^-]+)\.js$/)[1]) || "";
|
||||
const responsePath = fullPath(portsHash, request, hasFsAccess);
|
||||
|
||||
// TODO check cache expiration time and delete and go to else if expired
|
||||
@ -57,11 +57,12 @@ function lookupOrPerform(portsFile, mode, rawRequest, hasFsAccess) {
|
||||
let portDataSourceImportError = null;
|
||||
try {
|
||||
if (portsFile === undefined) {
|
||||
throw "missing"
|
||||
throw "missing";
|
||||
}
|
||||
const portDataSourcePath = path.resolve(portsFile);
|
||||
// On Windows, we need cannot use paths directly and instead must use a file:// URL.
|
||||
portDataSource = await import(url.pathToFileURL(portDataSourcePath).href);
|
||||
// portDataSource = await require(url.pathToFileURL(portDataSourcePath).href);
|
||||
portDataSource = require(portDataSourcePath);
|
||||
} catch (e) {
|
||||
portDataSourceImportError = e;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user