-
package.json {
// ...
"dependencies": {
"fastify": "~4.26.2"
}
} hello.js const fastify = require('fastify')({ logger: true })
fastify.route({
url: '/',
method: ['GET', 'POST'],
handler: async function (req, reply) {
return {
"status": "UP"
}
}
})
fastify.listen({ port: 3000, host: '0.0.0.0' }) sea-config.json {
"main": "hello.js",
"output": "hello.blob"
} sea package sh node --experimental-sea-config sea-config.json
cp $(command -v node) hello
npx postject hello NODE_SEA_BLOB hello.blob \
--sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 run $ ./hello
node:internal/util/embedding:48
throw new ERR_UNKNOWN_BUILTIN_MODULE(id);
^
Error [ERR_UNKNOWN_BUILTIN_MODULE]: No such built-in module: fastify
at embedderRequire (node:internal/util/embedding:48:11)
at hello.js:1:17
at embedderRunCjs (node:internal/util/embedding:37:10) {
code: 'ERR_UNKNOWN_BUILTIN_MODULE'
}
Node.js v21.7.1 |
Beta Was this translation helpful? Give feedback.
Answered by
Gadzy
Mar 29, 2024
Replies: 1 comment
-
From the documentation You'd have to first bundle your app into a single .js file using a tool like esbuild. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
atlowChemi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From the documentation
require(id)
in the injected main script is not file based.You'd have to first bundle your app into a single .js file using a tool like esbuild.