Node_modules - disk usage


#1

Hello Glitchers!

Is it true that the node_modules directory will not use disk space? Isn’t it then possible to abuse this, for example your app needs a database, or some sort of storage, that just might need to use a lot of space. Wouldn’t it then just be possible to create a npm package that interacts with the file system for you, and stores the files you need relatively to the node_modules/(module) directory.

If this is so, will it ever be patched, fixed, ignored or dealt with as a break of terms?


#2

by default, glitch projects use pnpm as a package manager and in that case you’re using shared packages with the rest of the community. those shared packages do not count towards your disk space limit. any other contents do!


#3

Are you technically saying it is possible to abuse Glitch’s disk space limit?


#4

no - what i am saying is that if you add things to node_modules outside of pnpm installation it will count towards your disk space limit


#5

Cool! Thanks for such a quick reply :+1:


#6

you’re welcome! by the way, if you happen to remix a project that’s using npm (you can tell if you remix and see npm install running in the logs instead of pnpm), you can run enable-pnpm in the console to change that.

on the flip side you can run enable-npm if you prefer to use npm instead - although those packages will count towards your disk space limit.


#7

Alright, also, something just hit my mind, say there was a json file within the module directory, if content was added to just that already existing file, would that also go towards your disk space limit? Not that I’m going to do that… Just out of complete curiosity…


#8

Yes that would count.


#9

Cool! Like how you guys think of everything :ok_hand:


#10

Also, in case you’re worried about security - anything you write to the node_modules folder is not shared with other projects, so you can’t change express.js (for example), and do nasty things to other people’s projects.