Error: Cannot use import statement outside a module

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 .