Skip to content

Commit

Permalink
Merge branch 'master' into fix-multi
Browse files Browse the repository at this point in the history
  • Loading branch information
developit committed Jan 10, 2020
2 parents 4d28c50 + 7e9c723 commit 16a7244
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ node_modules
*.log
build
dist
coverage
package-lock.json
yarn.lock
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@
"jasmine-sinon": "^0.4.0",
"karmatic": "^1.0.5",
"microbundle": "^0.4.2",
"sinon": "^5.1.0"
"sinon": "^5.1.0",
"webpack": "^4.41.2"
},
"dependencies": {
"comlinkjs": "^2.4.1",
"loader-utils": "^1.1.0",
"slash": "^3.0.0",
"worker-loader": "^2.0.0"
}
}
3 changes: 2 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import path from 'path';
import loaderUtils from 'loader-utils';
import slash from 'slash';

const comlinkLoaderSpecificOptions = ['multiple', 'multi', 'singleton'];

Expand All @@ -36,7 +37,7 @@ loader.pitch = function (request) {
import {Comlink} from 'comlinkjs';
${multi ? '' : 'var inst;'}
export default function f() {
${multi ? 'var inst =' : 'inst = inst ||'} Comlink.proxy(require('!worker-loader?${JSON.stringify(workerLoaderOptions)}!${path.resolve(__dirname, 'comlink-worker-loader.js')}!${request}')());
${multi ? 'var inst =' : 'inst = inst ||'} Comlink.proxy(require('!worker-loader?${JSON.stringify(workerLoaderOptions)}!${slash(path.resolve(__dirname, 'comlink-worker-loader.js'))}!${request}')());
return this instanceof f ? new inst : inst;
}
`.replace(/\n\s*/g, '');
Expand Down

0 comments on commit 16a7244

Please sign in to comment.