My directory:
\n.\n├── Dockerfile\n├── app-out.cjs\n├── app-out.cjs.map\n├── package-lock.json\n├── package.json\n├── sea-config.json\n└── src\n └── app.js\nIt works fine if I keep the file app-out.cjs in the directory. But the functionality of source-map disappears if I delete the bundled source file.
\nThe condition conflict with my purpose because I want to delivery only the application without source code.
rm app-out.cjs\n\n./app\nExpress server listening on port 3000\n(do something and throw an error)\n\nError: my error\n at app-out.cjs:6464:9\n at Layer.handle [as handle_request] (/usr/app/node_modules/express/lib/router/layer.js:95:5)\n at next (/usr/app/node_modules/express/lib/router/route.js:137:13)\n at Route.dispatch (/usr/app/node_modules/express/lib/router/route.js:112:3)\n at Layer.handle [as handle_request] (/usr/app/node_modules/express/lib/router/layer.js:95:5)\n at /usr/app/node_modules/express/lib/router/index.js:281:22\n at Function.process_params (/usr/app/node_modules/express/lib/router/index.js:335:12)\n at next (/usr/app/node_modules/express/lib/router/index.js:275:10)\n at cors (/usr/app/node_modules/cors/lib/index.js:188:7)\n at /usr/app/node_modules/cors/lib/index.js:224:17\nCould anyone give me some idea or advice?
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"There is currently no VFS/FS hooks support in Node.js in general. Effectively the SEA supports a main script and a list of assets, and it's up to the user how they can map the bundled assets and redirect fs calls (internal or user-land) to it (currently, they can only monkey-patch fs, until proper fs hooks are agreed upon and implemented by someone : #43). Internally, not being able to locate the file inside the SEA (as there's no VFS support) would just lead to missing source maps.
","upvoteCount":2,"url":"https://github.com/nodejs/single-executable/discussions/97#discussioncomment-9514188"}}}-
|
I have build an application with esbuild and Node SEA. The application works. However, after I build with source-map option of esbuild. The final application is just as the same, instead of logging with source-map. The following is my script in Dockerfile: # ...
RUN npx --yes esbuild src/app.js --sourcemap --bundle --platform=node --packages=external --outfile=app-out.cjs
# or --sourcemap=inline
RUN echo "const { createRequire } = require('node:module'); require = createRequire(__filename);" >> tmp-app-out.cjs && cat app-out.cjs >> tmp-app-out.cjs && mv tmp-app-out.cjs app-out.cjs
RUN node --experimental-sea-config sea-config.json && cp $(command -v node) app && npx --yes postject app NODE_SEA_BLOB sea-prep.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2
CMD ["./app"]My directory: It works fine if I keep the file Could anyone give me some idea or advice? |
Beta Was this translation helpful? Give feedback.
-
|
There is currently no VFS/FS hooks support in Node.js in general. Effectively the SEA supports a main script and a list of assets, and it's up to the user how they can map the bundled assets and redirect fs calls (internal or user-land) to it (currently, they can only monkey-patch fs, until proper fs hooks are agreed upon and implemented by someone : #43). Internally, not being able to locate the file inside the SEA (as there's no VFS support) would just lead to missing source maps. |
Beta Was this translation helpful? Give feedback.
There is currently no VFS/FS hooks support in Node.js in general. Effectively the SEA supports a main script and a list of assets, and it's up to the user how they can map the bundled assets and redirect fs calls (internal or user-land) to it (currently, they can only monkey-patch fs, until proper fs hooks are agreed upon and implemented by someone : #43). Internally, not being able to locate the file inside the SEA (as there's no VFS support) would just lead to missing source maps.