Skip to content

Commit e281697

Browse files
committed
[scramjet] clean up node externalizer
1 parent 6e390ee commit e281697

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

packages/scramjet/rspack.config.ts

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ import { defineConfig } from "@rspack/cli";
22
import { rspack, type RspackOptions } from "@rspack/core";
33
import { RsdoctorRspackPlugin } from "@rsdoctor/rspack-plugin";
44
import { TsCheckerRspackPlugin } from "ts-checker-rspack-plugin";
5-
// import nodeExternals from "webpack-node-externals";
5+
6+
function nodeExternals({ context, request }, callback) {
7+
if (!/^(\.|\/)/.test(request)) {
8+
return callback(null, request);
9+
}
10+
11+
callback();
12+
}
613

714
import { readFile } from "node:fs/promises";
815
import { execSync } from "node:child_process";
@@ -272,18 +279,7 @@ const bootstrapConfig = createGenericConfig({
272279
outputModule: true,
273280
},
274281
target: "node",
275-
externals: [
276-
function ({ context, request }, callback) {
277-
console.log(request);
278-
if (!/^(\.|\/)/.test(request)) {
279-
// Externalize to a commonjs module using the request path
280-
return callback(null, request);
281-
}
282-
283-
// Continue without externalizing the import
284-
callback();
285-
},
286-
],
282+
externals: [nodeExternals],
287283
});
288284

289285
const controllerConfig = createGenericConfig({

0 commit comments

Comments
 (0)