jlmakes / jlmakes/karma-rollup-preprocessor

dependencies are duplicated for each test file

Open
#49 19 comments 3 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
74
Forks
30
PR merge metrics
No merged PRs in 30d

Description

Each test file is treated as a separate bundle. Common dependencies are duplicated between the test files.

This is wasteful, and creates extra overhead for large project. But more importantly it creates issues when working with web components, as they may only be registered once per document. Bundling the same web component twice will throw an error.

I creates a reproduction for this: https://github.com/LarsDenBakker/karma-rollup-preprocessor-issues

```
npm install
npm run test:dynamic-import
optionally, debug the code at: http://localhost:9876/debug.html
```

You will see the error being thrown. If you inspect the output bundles in the browser, you will see the web component code bundled twice.

We are switching from webpack to rollup for our recommended setup for developers working with web component at: https://open-wc.org/

We had a similar issue with webpack https://github.com/webpack-contrib/karma-webpack/issues/379 which we were able to solve.

Happy to help out where possible.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.