Skip to content

Commit

Permalink
[patch] report error that's not module not found
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Jun 15, 2021
1 parent baa2dc9 commit 06a90c9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/xarc-app-dev/src/lib/babel-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ const xarcCwd = xarcOptions.cwd;
try {
// Try to load user's dev.js under src/server
start = require(Path.resolve(xarcCwd, serverDir, "dev.js"));
} catch (e) {
} catch (err) {
if (err.code !== "MODULE_NOT_FOUND") {
throw err;
}

// fallback to default action that loads babel-register and then requires
// src/server, under which there should be an index.js file.
require("@babel/register")({
ignore: [util.getBabelExclude(xarcOptions)],
extensions: [".js", ".jsx"]
.concat(xarcOptions.babel.enableTypeScript && [".ts", ".tsx"])
.filter(x => x),
cache: true
.filter((x) => x),
cache: true,
});

const fullServerDir = Path.resolve(xarcCwd, serverDir);
Expand Down

0 comments on commit 06a90c9

Please sign in to comment.