hero21's avatar

Can I delete node_modules after using Gulp ?

The laravel application file size is only about 34MB. When I tried to use gulp for combining my assets. the size of my application is now 200++ MB.

After running the npm install command, I found that it had created a file node_modules in my laravel application. And its is about 160 MB. Can I delete it that folder after combining my assets or not, I should let it be there ?

0 likes
6 replies
bashy's avatar

It should be excluded from git but you will need that folder if you want to gulp again (locally).

1 like
hero21's avatar

@bashy thanks you. In production, If I delete, wouldn't it break my application ?

1 like
martinbean's avatar
Level 80

@hero21 You’ll need the contents of the node_modules directory to run any gulp commands, but if you’re deploying and then running gulp to build your assets, you could theoretically delete your node_modules directory.

Even better, have a build server that does this and then uploads only the necessary, generated files.

1 like
edgeMD's avatar

@martinbean I know this is old, but is it advisable to .gitignore the node_modules folder? I'm setting up webpack and now I have 24,000 + files in my node_modules file.

Please or to participate in this conversation.