Issue with importing a node package in the Zendesk custom app
Hi All,
I have installed a node package which I am trying to use in a custom app.In this case let's say the package name is "test-package".When I try to run this locally it gives an error "Uncaught SyntaxError: Cannot use import statement outside a module"
Is there a different way to import these packages?
Thanks!
-
I have tried the below code too but no luck. Require is not recognized at all.
const MeechumUser = require('test-package'); -
Hey Sumitha Sudevan,
Thanks for reaching out! To start with, here's a couple things you can try:
- Add
type="module"
to your package.json file. Docs - Try using the Browserify package which allows you to use the
require
method, client-side.
Tipene - Add
Please sign in to leave a comment.
2 Comments