Skip to content

Commit

Permalink
chore: workaround esbuild issues with windows paths
Browse files Browse the repository at this point in the history
  • Loading branch information
epetrow committed May 26, 2023
1 parent 2411983 commit e966056
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/html/misc/esbuild-plugin-shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = ({ dir: sharedDir, main: mainFile }) => ({

build.initialOptions.entryPoints = entryPoints;

const entryPointsRegex = new RegExp(`(${entryPoints.join("|")})`);
// Esbuild will parse this to a GO Regex which causes Windows paths to fail.
const entryPointsRegex = new RegExp(`(${entryPoints.map(e => e.replace(/\\/g, '[\\\\]')).join("|")})`, 'g');

const sharedMain = p.join(sharedDir, mainFile);
const sharedApp = fs.readFileSync(sharedMain, "utf-8");
Expand Down
4 changes: 2 additions & 2 deletions scripts/start-dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ entryPoints.forEach((point) => entiresMap.add(point));
servedir: "./",
port: 8000,
});
const outputs = glob.sync(`./packages/html/dist/**/tests/**/app.js`, { dotRelative: true });
const outputs = glob.sync(`./packages/html/dist/**/tests/**/app.js`, { dotRelative: false });

// Then start a proxy server on port 3000
http.createServer((req, res) => {
const tests = outputs.map((point) => path.join(path.dirname(point)));
const tests = outputs.map(t => t.replace(/\\/g, '/')).map((point) => path.dirname(point));

const options = {
hostname: host,
Expand Down

0 comments on commit e966056

Please sign in to comment.