Closed torjuss closed 7 years ago
yeah... I have the same problem when deploying on heroku, so my workaround was to set NPM_CONFIG_PRODUCTION=false, which forces NPM to run in development but will build the App with the current env, i.e production. I don't have much experience with Azure so I can't tell you if there is a similar flag or approach, I would look in stackoverflow as somebody most likely hit the same issue.
Another workaround would be to move all packages into regular dependencies for your project, but that kind of defeats the purpose of splitting dev vs regular. I made this choice to have a cleaner separation for people who have a different deployment mechanism and may not want to install all deps which are only used to build the frontend.
Sorry for the inconvenience. I'm going to close this, but feel free to update the thread if you find a Azure-specific workaround, thanks!
Okay, I will just stick to my workaround then and use a custom deployment (.cmd) script in Azure where I override the default behaviour by replacing "npm install --production" (or "npm install --only=prod") with just "npm install". I finally found someone else using a similar apporach in this article. I am still a little confused about why e.g. jquery is a dev dependency, but it doesn't really matter as long as my deployment works. 👍
The dev dependencies are typically the packages required to build the UI, such as react and jquery. The regular dependencies are the ones needed to run the node server, assuming the dist/ has been generated previously.
When you look at it that way it makes more sense. Thank you!
Hi, and thanks for a great boilerplate!
I building an application based on this boilerplate and have set up deployment of the project to an Azure web app. I wanted the web app to handle the production build (the "dist" folder) so that "dist" doesn't have to be included in my git source control. I managed to build the project on the Azure server, but only when I forced installation of all devDependencies. The default behaviour in Azure is to skip dev dependencies when the environment is set to production. So I am wondering why so many of the dependencies are listed as devDependencies. Shouldn't packages like bootstrap, jquery and react be regular dependencies?