Open larssn opened 5 years ago
I've done it in the past https://github.com/TeamHive/nativescript-pspdfkit/blob/master/src/android/pspdfkit.ts#L50-L55
I'm trying to load a worker from my nativescript plugin with no succed. I did the same as @triniwiz did
if (global["TNS_WEBPACK"]) {
var UploaderWorker = require('nativescript-worker-loader!./google-drive.worker');
config.worker = new UploaderWorker();
} else {
config.worker = new Worker('./google-drive.worker');
}
nativescript-worker-loader
works perfectly in a core or Angular app, but it's not works inside the plugin, I'm getting this error "Error: Cannot find module 'nativescript-worker-loader!./google-drive.worker'".
I'm using NativeScript v6.
{
"platforms": {
"android": "6.0.0",
"ios": "6.0.1"
}
}
So we're trying to create a plugin that uses workers.
Am I correct in assuming that it would only work if the plugin is built with Webpack (and worker-loader), IF the consuming application is also built with Webpack?
I can't figure out how webpack in
some-app
would try to resolve a relative path insidenode_modules/some-plugin
that points to aworker.ts/js
file.