commit 87765a4023e33d9502cf55ad2592dabf262ddc69
parent afb91f0dc06294d9a1fdb30c6821eaeed71ae427
Author: Sebastian <sebasjm@gmail.com>
Date: Tue, 16 Jan 2024 17:27:10 -0300
load .node as files
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/packages/web-util/build.mjs b/packages/web-util/build.mjs
@@ -56,6 +56,8 @@ function git_hash() {
*
* Reference:
* https://github.com/evanw/esbuild/issues/1051#issuecomment-806325487
+ *
+ * kept as reference, need to be tested on MacOs
*/
const nativeNodeModulesPlugin = {
name: 'native-node-modules',
@@ -63,7 +65,7 @@ const nativeNodeModulesPlugin = {
// If a ".node" file is imported within a module in the "file" namespace, resolve
// it to an absolute path and put it into the "node-file" virtual namespace.
build.onResolve({ filter: /\.node$/, namespace: 'file' }, args => ({
- path: path.resolve(args.path, { paths: [args.resolveDir] }),
+ path: require.resolve(args.path, { paths: [args.resolveDir] }),
namespace: 'node-file',
}))
@@ -101,6 +103,7 @@ const buildConfigBase = {
loader: {
".key": "text",
".crt": "text",
+ ".node": "file",
".html": "text",
".svg": "dataurl",
},
@@ -109,7 +112,7 @@ const buildConfigBase = {
__VERSION__: `"${_package.version}"`,
__GIT_HASH__: `"${GIT_HASH}"`,
},
- plugins: [nativeNodeModulesPlugin],
+ //plugins: [nativeNodeModulesPlugin],
};
/**