Open ravecat opened 3 years ago
with your current configuration the worker gets embedded in the index file as a base64 string so there is no need for a standalone worker file. If you want to output an explicit worker file, use the inline
option:
...
[
...
webWorkerLoader({ inline: false }).
...
]
...
as for the warning, I assume that your worker source file is in the worker
folder? if so, your import should be:
import WebWorker from 'web-worker:./worker/Worker.ts';
@darionco thank you for quick answer and for a little misunderstanding, I am trying to build a project from your example https://github.com/darionco/rollup-typescript-webworkers and get current warning and build structure
So, yes worker exist in right path. How do js resolve web-worker:./worker/Worker.ts
? I mean npm-published module. Or maybe I expect impossible from that plugin
I am not sure I understand the question, I'll try to explain how the plugin works by default.:
by following those steps, the dist
folder doesn't need to ship a worker file because the file is embedded into the main JavaScript file (index.js
in the example you linked).
If what you want is for the worker file to not be embedded into the main JavaScript file, that can be done using the option I suggested above:
...
[
...
webWorkerLoader({ inline: false }).
...
]
...
Otherwise you could look into using rollup-plugin-off-main-thread
since that plugin main functionality is code splitting while this plugin's main functionality is embedding the workers in the main file.
Let me know if that helps.
I am a bit confused about building the project from ts example https://github.com/darionco/rollup-typescript-webworkers. how do the bundle will link to the worker if it is located on an inaccessible path and only
dist/**
send into the published packagecould you clarify that and give an example of rollup config
I've expected similar structure after bundle
with current plugins section
I get warning