CMS Development

hubertspot
Member

Importing npm packages in CRM custom extensions React.js

I attempted to import npm packages while creating a custom React app extension, specifically chalk and d3-react-tree, for testing purposes. I added these packages to package.json using the notation "chalk": "latest", as outlined in the README, while working with the CRM private app template.

However, I encountered some issues: In Example.jsx, chalk only functions properly in the local environment (hs project dev) and fails when deployed (hs project upload). Additionally, in example-function.js, any attempt to import results in a script crash, regardless of whether I use import chalk from 'chalk'; or const chalk = require('chalk');.

 

Has anyone successfully imported regular npm packages besides the preloads when creating React crm extensions?

0 Upvotes
1 Reply 1
Jaycee_Lewis
Community Manager
Community Manager

Importing npm packages in CRM custom extensions React.js

Hi, @hubertspot 👋 Thanks for your question. I'd like to invite some of our community members to the converstaion — hey @albertsg @zach_threadint @Teun have you run into this or similar issues in your project work?

 

Thank you for taking a look! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes