Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
rollup-plugin-off-main-thread
Advanced tools
Readme
Use Rollup with workers and ES6 modules today.
$ npm install --save rollup-plugin-off-main-thread
Workers are JavaScript’s version of threads. Workers are important to use as the main thread is already overloaded, especially on slower or older devices.
This plugin takes care of shimming module support in workers and allows you to use new Worker()
.
OMT is the result of merging loadz0r and workz0r.
// rollup.config.js
import OMT from "rollup-plugin-off-main-thread";
export default {
input: ["src/main.js"],
output: {
dir: "dist",
// You _must_ use “amd” as your format
format: "amd"
},
plugins: [OMT()]
};
I set up a gist to show a full setup with OMT.
{
// ...
plugins: [OMT(options)];
}
loader
: A string containing the EJS template for the amd loader. If undefined
, OMT will use loader.ejs
.useEval
: Use fetch()
+ eval()
to load dependencies instead of <script>
tags and importScripts()
. This is not CSP compliant, but is required if you want to use dynamic imports in ServiceWorker.marker
: A string that is temporarily injected to mark new Worker()
calls. It’s only purpose is to be unique enough that the string sequence can’t appear by coincidence in ohter places. The default should be fine 99% of the time.workerRegexp
: A RegExp to find new Workers()
calls. The second capture group must capture the provided file name without the quotes.filenameRegexp
: A RegExp that finds the file name after Rollup has transformed dynamic imports.amdFunctionName
: Function name to use instead of AMD’s define
License Apache-2.0
FAQs
Use Rollup with workers and ES6 modules today.
The npm package rollup-plugin-off-main-thread receives a total of 27 weekly downloads. As such, rollup-plugin-off-main-thread popularity was classified as not popular.
We found that rollup-plugin-off-main-thread demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.