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.
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.
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.
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.
If this answer solved your question, please mark it as the solution.
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?
jun 26, 20238:47 AM - editado jun 26, 20238:51 AM
Experto reconocido | Partner nivel Elite
Uploading node_modules
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.
If this answer solved your question, please mark it as the solution.