Does vender need to be transferred to the server?

I am a front-end developer. Some time ago, I came into contact with php and found that php has the same thing as front-end npm. Composer, and then npm download dependencies are placed in the node_modules folder, while composer download dependencies are stored in the vender folder. So the question is, the front end relying on node_modules does not need to be deployed to the online server, should vender be deployed to the server?

Sep.23,2021

No, run the server online.

composer install
Just

.


of course you need


1L. There is no problem with php's composer and npm. After the front end is installed using the npm package, it will be build before deployment. At this time, the used library code has been packaged, such as react , and the code related to react will be packaged into the final file, but php So you still need to install these packages on the server, but you don't need to upload vendor directly, just install them on the server again.


it depends on whether you are a front-end application or a nodejs application.

if it is a front-end application, most of the current situation is that you need to offline compile and package the modules that node_modules depends on using compilation tools (such as webpack) into modular code recognized by the browser (because npm uses the commonjs specification, so this process is called parsing commonjs), and uploading it to the server or CDN.

if it is a nodejs application, you don't need to upload these vendor, you just need to update package.json (similar to composer.json in php), and execute npm install or yarn install (similar to composer install in php) on the server when you publish and deploy the application.

Menu