Some of the files in my /dist are deployed properly, and some others are for some reason redirected to /
I noticed that the paths of those redirected all start with /node_modules. However, this is not a mistake. I do want to serve static assets from there. Is there an option somewhere not to ignore /node_modules/* in /dist?
I am just using the Github-connected automatic build, which runs npm run build and succeeds, creating a dist directory with all artifacts to be deployed.
Those artifacts reside in multiple subdirectories, and all assets in, say, /dist/src/pages/ are deployed and served as I expect, while others in /dist/node_modules/some_package/ seem not to be there: the response the browser gets on fetch is the top index.html instead.
I am experimenting with my own js framework, so I could of course find a workaround, but if I put something in dist, isn’t it intentional enough?
What happens really is that the dependencies themselves live in the project’s root directory, but what I put into dist are the versions transpiled with my own transpiler and I want to serve them from there. There’s no bundler as such, so I am preserving the original directory structure.
To be more precise, I am of course not trying to upload the whole node_modules, but only the specific files that were hit during the build (and thus are truly needed for the app to function). Since there is no bundler, that code has to be somewhere so I thought I could get away with just using the same filenames and paths inside /dist.
But well, I guess, there might be situations where people are erroneously uploading their whole node_modules and that indeed might be a problem for you guys
Ok, Thank you for the confirmation of my hunch anyway, I’ll try to find a workaround for this…
Hi @dmitry.maevsky, I sometimes try to develop something new, so I understand you trying to create your own framework.
My suggestion is: if you are developing your own framework, you can rename the node_modules subdir inside your dist build and set up your framework to get dependencies in that new path.
It is an industry-standard rule that node_modules is a development-only dependency directory, so your framework would face many issues in virtually any deploy environment.