preactjs / wmr

👩‍🚀 The tiny all-in-one development tool for modern web apps.
https://wmr.dev/
MIT License
4.92k stars 109 forks source link

fix: Worker detection #948

Closed rschristian closed 1 year ago

rschristian commented 1 year ago

Workers must have .worker in their name yet this regex didn't test for it. So new URL('./foo.js', import.meta.url) is (incorrectly) treated as a worker.

This behavior is still super sketchy and flawed, as a simple console.log(new URL('./foo.worker.js', import.meta.url)) will trigger (in prod, in dev the user will just get errors) WMR to emit another file, but this at least reduces the chances of users running into it.

changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: a232ceabe3bed6560ac4f4a5742f750a005e31a5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---- | ----- | | wmr | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

github-actions[bot] commented 1 year ago

Size Change: +5 B (0%)

Total Size: 806 kB

Filename Size Change
packages/wmr/wmr.cjs 767 kB +5 B (0%)
ℹ️ View Unchanged | Filename | Size | | :--- | :---: | | `examples/demo/dist/about/index.html` | 720 B | | `examples/demo/dist/alias-outside/index.html` | 696 B | | `examples/demo/dist/assets/Calendar.********.css` | 694 B | | `examples/demo/dist/assets/style.********.css` | 624 B | | `examples/demo/dist/chunks/alias-outside.********.js` | 138 B | | `examples/demo/dist/chunks/class-fields.********.js` | 210 B | | `examples/demo/dist/chunks/compat.********.js` | 17 kB | | `examples/demo/dist/chunks/hoofd.module.********.js` | 1.47 kB | | `examples/demo/dist/chunks/index.********.js` | 200 B | | `examples/demo/dist/chunks/json.********.js` | 238 B | | `examples/demo/dist/chunks/meta-tags.********.js` | 297 B | | `examples/demo/dist/chunks/prerender.********.js` | 294 B | | `examples/demo/dist/class-fields/index.html` | 708 B | | `examples/demo/dist/compat/index.html` | 1.64 kB | | `examples/demo/dist/env/index.html` | 786 B | | `examples/demo/dist/error/index.html` | 713 B | | `examples/demo/dist/files/index.html` | 742 B | | `examples/demo/dist/index.********.js` | 8.19 kB | | `examples/demo/dist/index.html` | 774 B | | `examples/demo/dist/json/index.html` | 719 B | | `examples/demo/dist/lazy-and-late/index.html` | 722 B | | `examples/demo/dist/meta-tags/index.html` | 785 B |

compressed-size-action