Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: sanitise options before passing to worker-loader #17

Merged
merged 2 commits into from
Jan 10, 2020

Conversation

jackyef
Copy link
Contributor

@jackyef jackyef commented Jan 10, 2020

I am using multi to be able to instantiate multiple workers. Here is how I am using comlink-loader in my code.

const Worker = await import(
        /* webpackChunkName: "workerized-decode-qr" */ 'comlink-loader?multi&inline!../utils/WorkerisedCode'
      ).then(m => m.default);

Upon building, I got this error.

ValidationError: Worker Loader Invalid Options

options['multi'] is an invalid additional property

Apparently, comlink-loader is forwarding all options it receives to worker-loader. This PR adds a sanitation step before passing options to worker-loader

Build is successful on my machine. Not sure what is causing the CI to fail.

➜  comlink-loader git:(master) npm run build

> comlink-loader@1.1.0 build /Users/jacky/Personal/Projects/comlink-loader
> microbundle --inline none --format cjs --no-compress src/*.js

Build output to dist:
        186 B: comlink-worker-loader.js
        554 B: comlink-loader.js
Copy link
Collaborator

@developit developit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@developit
Copy link
Collaborator

The CI failure is my fault, will fix.

@developit developit merged commit 4a2056e into GoogleChromeLabs:master Jan 10, 2020
@jackyef jackyef deleted the fix-multi branch January 12, 2020 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants