Consider the full-stack application project with NodeJS back-end.
package.json
includes dependencies for both front-end (likevue
,vuex
, etc.) and back-end (likebody-parser
,express
, etc.).- The entry point for frontend (
EntryPoint-FrontEnd.js
) and entry point for backend (EntryPoint-BackEnd.js
) are being built by different Webpack config; the main differences is usage of webpack-node-externals andtarget: "node"
for back-end. - The dependencies for frontend are being bundled to
EntryPoint-FrontEnd.js
, butEntryPoint-BackEnd.js
access to dependencies withwebpack-node-externals
.
Now: how to copy to 02-ProductionBuild
only those dependencies, which using EntryPoint-BackEnd.js
via webpack-node-externals
?
I glad if can reach it by webpack-node-externals
, but if impossible, other tools are welcome.
The basic practice is deploying the full project to host and installing dependencies by npm install
. However all that we need for working application in server is 02-ProductionBuild
folder including dependencies for EntryPoint-BackEnd.js
.
from How to copy "node_modules" using by "webpack-node-externals" to directory with production building?
No comments:
Post a Comment