0.2.0 • Published 2 years ago

next-worker v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

next-worker

Makes it simple to create and manage Web Workers in NextJS. Detects imports to *.worker.[js|ts] and manages the hard stuff for you.

Caution: This package is still under development.

Without next-worker:

useEffect(() =>  {
  worker = new Worker(new URL('./bg-task.js', import.meta.url));;
}, []);

With next-worker:

import worker from './bg-task.worker.js'

Usage

In your next.config.json:

module.exports = {
  webpack: config => {
    config.module.rules.push({
      test: /\.worker\.js$/,
      use: [{ loader: 'next-worker' }]
    });
  }
}
0.2.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago