modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.22k stars 288 forks source link

CommonJS plugin unable to include library #1814

Open chandruchiku opened 2 years ago

chandruchiku commented 2 years ago

I'm using lit typescript project with web-dev-server. I'm able to run the bare metal app, however web-dev-server fails to include commonjs modules even after including commonjs plugin. Throws this error : Not allowed to load local resource: file:///C:/Codelearningopen-wc-app-projode_modulesamazon-chime-sdk-js%08uildloggerLogLevel.js?commonjs-exports

Steps to reproduce:

  1. Start a new open-wc webcomponent : npm init @open-wc
  2. Chose the values as :
√ What would you like to do today? » Scaffold a new project
√ What would you like to scaffold? » Application
√ What would you like to add? » Linting (eslint & prettier), Testing (web-test-runner), Building (rollup)
√ Would you like to use typescript? » Yes
√ What is the tag name of your app shell element? ... open-wc-app-proj
  1. Install packages, 'amazon-chime-sdk-js', '@rollup/plugin-commonjs'
  2. Change web-dev-server.config.mjs values to include commonjs plugin
  3. Run the app using npm run start

Github Code : Code with all steps done

Westbrook commented 1 year ago

We're testing some canary releases against this issue, if you're interested in helping us out here:

🦋  Creating git tags...
🦋  New tag:  @web/dev-server@0.0.0-canary-20230216020153
🦋  New tag:  @web/dev-server-core@0.0.0-canary-20230216020153
🦋  New tag:  @web/dev-server-esbuild@0.0.0-canary-20230216020153
🦋  New tag:  @web/dev-server-hmr@0.0.0-canary-20230216020153
🦋  New tag:  @web/dev-server-import-maps@0.0.0-canary-20230216020153
🦋  New tag:  @web/dev-server-legacy@0.0.0-canary-20230216020153
🦋  New tag:  @web/dev-server-rollup@0.0.0-canary-20230216020153
🦋  New tag:  @web/dev-server-storybook@0.0.0-canary-20230216020153
🦋  New tag:  @web/test-runner-core@0.0.0-canary-20230216020153

If they work for you, or not, we'd love to know.