mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-27 22:01:48 +03:00
Fix import of port-data-source.js on Windows.
This commit is contained in:
parent
b3f0ebba9d
commit
10cf930226
@ -1,4 +1,5 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const url = require("url");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
const objectHash = require("object-hash");
|
const objectHash = require("object-hash");
|
||||||
const kleur = require("kleur");
|
const kleur = require("kleur");
|
||||||
@ -55,7 +56,9 @@ function lookupOrPerform(portsFile, mode, rawRequest, hasFsAccess) {
|
|||||||
let portDataSource = {};
|
let portDataSource = {};
|
||||||
let portDataSourceFound = false;
|
let portDataSourceFound = false;
|
||||||
try {
|
try {
|
||||||
portDataSource = await import(path.join(process.cwd(), portsFile));
|
const portDataSourcePath = path.join(process.cwd(), portsFile);
|
||||||
|
// On Windows, we need cannot use paths directly and instead must use a file:// URL.
|
||||||
|
portDataSource = await import(url.pathToFileURL(portDataSourcePath).href);
|
||||||
portDataSourceFound = true;
|
portDataSourceFound = true;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user