0.6.1 • Published 9 months ago

@shopify/web-worker-swc-plugin v0.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

shopify_web_worker_swc_plugin

Plugin for @shopify/web-worker.

A swc plugin that identifies uses of createWorkerFactory that need to be processed.

Tests

We do not recommend including the plugin for the test environments. When the swc plugin is omitted, Factory will know to access your module asynchronously, and will proxy all method calls to it. When in this mode, the function returned from createWorkerFactory will not actually construct a Worker for your code. As a result, this will only work if your worker code is written such that it will also execute successfully on the "main" thread. If you do use features in the worker that make it incompatible to run alongside the browser code, we recommend mocking the "worker" module (using jest.mock(), for example).

Usage

To load plugins, you may use swcrc's jsc.experimental configs:

{
  jsc: {
    ...
   experimental: {
     ...
     cache_root: String // optional, specify where swc will create wasm bytecode cache
    // list of plugins. If `pluginname` is resolvable to npm package, it'll try to load from installed npm packages.
    // or it can be an absolute path to the .wasm binary
     plugins: [
        [
          '@shopify/web-worker-swc-plugin',
          {
            "webpackLoader": path.resolve('@shopify/web-worker/build/cjs/webpack-parts/loader.js'),
            "packages": {
              "@shopify/web-worker": [
                {
                  "name": "createPlainWorkerFactory"
                },
                {
                  "name": "createWorkerFactory",
                  wrapperModule: path.resolve('@shopify/web-worker/build/cjs/wrappers/expose.js.raw'),
                }
              ]
            }
          }
        ]
      ]
   }
}
0.6.1

9 months ago

0.5.0

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.1

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago