Uploading node_modules

Hey, I found out today that I can’t upload node_modules because it’s blocked by hubspot. I get that node_modules isn’t ideal, but how else am I supposed to keep track of dependencies? I don’t think manually uploading every external dependency I need, or using a CDN, is a realistic solution because there’s no way to manage and update my dependencies.

You should really be using a source code repository like BitBucket or GitHub to store and track your files. The HubSpot Design Manager is not meant to be a respository, but a manager for compiled files only. Also, if you’re not already using it, I suggest using the HubSpot CLI to upload your compiled files.

No, I wanted to use the files in node modules - node modules for frontend usually have a compiled `dist` folder. I know it’s wasteful to upload the whole thing, but how else do I get tracked and organized dependencies for hubspot?

Files in node_modules should never be referenced directly in the project as that’s not how pcakages are meant to be used. Ideally the files should be getting compiled into your own files using imports and/or a bundler. If you aren’t comfortable with using bundlers and aren’t using very many packages you could instead use CDN or copy/paste the dist files directly into your project. Also, due to it’s normally large size, node_modules shouldn’t ever be tracked but instead managed with a package manager.

But how would you do that using github / hubspot CMS?

Hello @icheshire , I am not exactly aware of your development workflow.
But in the case of design manager and custom code workflows and serverless functions, You have to generate a bundle file and upload it to the place where you need it. There’s no direct way of uploading node_modules to hubspot cms because it is not meant for that.
Here is an example for custom code : How to Use NPM Packages in Custom Code Workflow Actions

Isn’t this for workflows, and not hubspot CMS?

Yes, this is for workflows, but you have to do a similar thing for cms as well, compile the modules in a bundle, upload it to the design manager using cli or directly, and then import it in the module using require_js or use the bundle globally and use the require function to get access to packages within the bundle.