Error: Cannot use import statement outside a module

I am trying to import some custom Vue code. Where is the correct place to import a package like the below?

import Okra from 'okra-js'

The correct way of importing external packages is a custom weweb component.

For examples on how to import packages you can have a look at my integration of Stripe Elements or weweb open source components .

Ok thank you. After reading the documentation, there is this point which I am unsure on.

If you are creating a new component, create a repository on Github and push your code. Then go to your dashboard, and add a source code pointing to your Github repository.

You have created a file called wwElement.vue but then how are you using this in your code? Do you load the custom script on project load, page load or by embedding some custom code with an element?

Ah I have seen a custom component tab in my workspace :slight_smile:

1 Like

The documentation has instructions for the development process and how to preview your component in development mode.

When it’s ready you connect the github repository to build the final component to use inside the live editor.

1 Like