question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

support `?inline` worker in constructors worker

See original GitHub issue

Clear and concise description of the problem

we can use inline worker with import worker from "./worker?worker&inline"

and need to support inline worker in constructors worker.

Suggested solution

  1. use query syntax
const worker = new Worker(new URL('./worker.js?inline', import.meta.url))

but the end goal is to remove query suffixes everywhere for Vite.

  1. put inline in worker options
const worker = new Worker(new URL('./worker.js', import.meta.url), {
  inline: true
})

that’s non-standard

  1. use the comment
const worker = new Worker(new URL(/* #__INLINE__ */'./worker.js', import.meta.url))

and Rollup has a history of avoiding that too (e.g. webpackChunkName) and only supported pure comments thus far.

above solutions are not good.

this issue for it to discussed some ideas ❤️

Alternative

No response

Additional context

No response

Validations

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
mathe42commented, Nov 14, 2022

Will have a deeper look into it later.

2reactions
mathe42commented, Apr 18, 2022

I’m not sure what’s the usecase for inlining workers yet, but I like the option with config.build.assetsInlineLimit since it reuses an existing config option. The naming could be a bit misleading though since worker isn’t really an asset, but I don’t think it’s a big issue 🤔

I don’t know either (limit requests?) but then just switch to http2. The only use case I can think of if you want to inline ALL workers. (When you want a single file so evrything is potentaly inlined into the html file)

(Only if you need to support IE11 (or older) in windows < 10 you have problems see https://caniuse.com/http2,webworkers )

Read more comments on GitHub >

github_iconTop Results From Across the Web

WebWorker support? · Issue #312 · evanw/esbuild - GitHub
Side note: it's possible to (partially) minify worker code with the inline-worker technique: This is fragile and can easily break with esbuild.
Read more >
INLINE CONSTRUCTION Careers and Employment - Indeed
Find out what works well at INLINE CONSTRUCTION from the people who know best. Get the inside scoop on jobs, salaries, top office...
Read more >
5 Key Qualities of Skilled Construction Workers | Tradesmen
Skilled construction workers must have 5 essential skills. Explore these key construction skills and request skilled construction laborers ...
Read more >
Using Web Workers - Web APIs - MDN Web Docs
Web Workers are a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering ......
Read more >
Construction Worker Jobs in Arkansas (Hiring Now!) - Zippia
Staffing Support Solutions logo. 4.2. Construction Helpers for Solar Farm Work · R Construction General Laborer. Richardson Properties, LLC · N Construction ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found