Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@blabu.com/next-workers
Advanced tools
Use [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) in your [Next.js](https://github.com/zeit/next.js) project using `import`.
Use Web Workers in your Next.js project using import
.
npm install --save @blabu.com/next-workers worker-loader
or
yarn add @blabu.com/next-workers worker-loader
Create a next.config.js
in your project
// next.config.js
const withWorkers = require('@blabu.com/next-workers')
module.exports = withWorkers({
/* config options here */
})
Optionally you can add your custom Next.js configuration as parameter
// next.config.js
const withWorkers = require('@blabu.com/next-workers')
module.exports = withWorkers({
webpack(config, options) {
return config
}
})
You can also pass overriding options to worker-loader using workerLoaderOptions
// next.config.js
const withWorkers = require('@blabu.com/next-workers')
module.exports = withWorkers({
workerLoaderOptions: { inline: true },
})
Web Worker files are identified by the .worker.js
or .worker.ts
extension
Because Workers are transpiled with worker-loader
you can import
dependencies just like other project files. See the worker-loader documentation for examples
// example.worker.js
self.addEventListener('message', (event) => console.log('Worker received:', event.data))
self.postMessage('from Worker')
The Worker can then be imported like a normal module and instantiated
// pages/example.js
import React from 'react';
import ExampleWorker from '../example.worker';
export default class extends React.Component {
state = { latestMessage: null }
componentDidMount() {
// Instantiate the Worker
this.worker = new ExampleWorker()
this.worker.postMessage('from Host')
this.worker.addEventListener('message', this.onWorkerMessage)
}
componentWillUnmount() {
// Close the Worker thread
this.worker.terminate()
}
onWorkerMessage = (event) => this.setState({ latestMessage: event.data })
render() {
return <h1>Message from Worker: {this.state.latestMessage}</h1>
}
}
FAQs
Use [Web Workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) in your [Next.js](https://github.com/zeit/next.js) project using `import`.
The npm package @blabu.com/next-workers receives a total of 0 weekly downloads. As such, @blabu.com/next-workers popularity was classified as not popular.
We found that @blabu.com/next-workers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.