I usually develop Node applications in Docker containers and bind-mount my source into the container, for instance, at /usr/src/app
. If the code throws a stack trace, I get something like:
TypeError: Cannot read property 'createElement' of undefined
at parseUrl (/usr/src/app/node_modules/auth0-lock/lib/utils/url_utils.js:6:31)
at extractClientBaseUrlOption (/usr/src/app/node_modules/auth0-lock/lib/core/index.js:425:42)
at Object.setup (/usr/src/app/node_modules/auth0-lock/lib/core/index.js:110:20)
at setupLock (/usr/src/app/node_modules/auth0-lock/lib/core/actions.js:47:13)
at Auth0Lock.Base (/usr/src/app/node_modules/auth0-lock/lib/core.js:77:36)
This is all coold and it makes sense because as far as Node knows, it's running in /usr/src/app. That's what we want after all – that our applications don't know anything about the host.
However, VS Code has a really handy feature where it parses paths in its integrated terminal and allows you to click on them to open the source. This doesn't work inside a container because the path is incorrect on the host. I need to 'rewrite' it (to use the term losely) to something like /Users/shankie/project/node_modules/auth0-lock/lib/utils/url_utils.js
Anyone had any luck with doing something similar? I can envisage possible solutions in both VS Code and in Node...
via shankie_san
No comments:
Post a Comment