stackblitz / core

Online IDE powered by Visual Studio Code ⚡️
https://stackblitz.com
MIT License
10.22k stars 883 forks source link

Can't use ESM libraries #1971

Open ChronosSF opened 2 years ago

ChronosSF commented 2 years ago

Description of Bug

I am trying to use a component from a library (igniteui-webcomponents) that is an ESM in an Angular application but it errors out with:

Error in /turbo_modules/igniteui-webcomponents@3.3.1/components/avatar/avatar.js (14:25) Unexpected token 'export'

When downloaded the app works fine.

Steps to Reproduce

You can use this sample app to reproduce: https://stackblitz.com/edit/angular-xajk1d

Expected Behavior

Ideally, the app should work within Stackblitz like it does when downloaded.

Totati commented 1 year ago

Start a Vite project from the starter templates, it will work with that :)

DanielHabenicht commented 2 months ago

I came across the same problem when linking my demo angular project to Stackblitz. Adding ?template=node to the link helped.