I'm using Linux on Azure to host my webapp and it deploys fine. My local dev tree structure looks like this:
- build
- node_modules
- src .deployment .env .gitignore package.json README.json ...
When I deploy to Azure it looks like this:
- dist
- node_modules
Within one of my files I re-utilize some components from a node module like so:
import Password from '../../../node_modules/path/to/components/forms/field-types/Password';
There are 2 potential ways to make this work:
- Deploy /dist into the root and have node_modules as a sibling but this then makes the relative path above break and ES6 doesn't allow dynamic import strings nor for them to be within blocks
- Set the /dist folder as the application root which is actually correct (eg: it contains server.js) and then the relative paths would be correct
I'd prefer #2 however the capability for doing virtual path mapping in Azure doesn't seem to exist so it seems I'd need to leverage .htaccess
. I'm curious if there are any other ways to do this and also if the root is set to /dist will the relative path still work or will it be blocked by the server?
Thanks.