How to use source map of esbuild with SEA #97
-
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.
Replies: 1 comment 1 reply
-
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.