Reputation: 155
I have a project on Laravel 5.4; I'm absolutely new to front-end package managers.
I used npm to install 4 packages in my project, so my node_modules
folder has about 210 MB.
I used Laravel Mix to combine in groups required dependencies and files, then I run npm run dev
.
My webpack.mix.js
looks like :
let mix = require('laravel-mix');
mix
.copy('node_modules/jquery/dist/jquery.js', 'public/js')
.combine([
'node_modules/video.js/dist/video-js.min.css',
'node_modules/videojs-record/dist/css/videojs.record.css'],'public/css/recordDependencies.css')
.combine([
'node_modules/video.js/dist/video.min.js',
'node_modules/recordrtc/RecordRTC.js',
'node_modules/webrtc-adapter/out/adapter.js',
'node_modules/videojs-record/dist/videojs.record.js',
'node_modules/jquery/dist/jquery.js',
'node_modules/blueimp-file-upload/js/vendor/jquery.ui.widget.js',
'node_modules/blueimp-file-upload/js/jquery.iframe-transport.js',
'node_modules/blueimp-file-upload/js/jquery.fileupload.js'
], 'public/js/recordDependencies.js');
So, it generates me this files. Making a small test, I replaced the node_js directory out of the project, and everything still works.
So, the question is :
Can I delete this huge folder -
node_modules
, or it must live in kernel of my project, at the deploying as well ?
Upvotes: 5
Views: 2815
Reputation: 2255
In frontend applications node_modules are only required for compiling resources. You would not want to deploy node_modules because they contain unobfuscated code. Only deploy compiled files.
Upvotes: 8