"version": "2.3.8",
"description": "A fast, easy to use Node.js Worker Thread Pool and Cluster Pool implementation",
"license": "MIT",
- "main": "lib/index.js",
+ "exports": [
+ "lib/index.js",
+ "lib/index.mjs"
+ ],
"scripts": {
"prepare": "node prepare.js",
"build": "rollup --config --environment BUILD:development",
export default {
input: 'src/index.ts',
- output: {
- ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.js' }),
- format: 'cjs',
- sourcemap: !!isDevelopmentBuild,
- ...(isDevelopmentBuild && { preserveModules: true }),
- ...(isDevelopmentBuild && { preserveModulesRoot: 'src' }),
- ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] })
- },
+ output: [
+ {
+ ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.js' }),
+ format: 'cjs',
+ sourcemap: !!isDevelopmentBuild,
+ ...(isDevelopmentBuild && {
+ preserveModules: true,
+ preserveModulesRoot: 'src'
+ }),
+ ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] })
+ },
+ {
+ ...(isDevelopmentBuild ? { dir: 'lib' } : { file: 'lib/index.mjs' }),
+ format: 'esm',
+ sourcemap: !!isDevelopmentBuild,
+
+ ...(isDevelopmentBuild && {
+ entryFileNames: '[name].mjs',
+ preserveModules: true,
+ preserveModulesRoot: 'src'
+ }),
+ ...(!isDevelopmentBuild && { plugins: [terser({ maxWorkers: 2 })] })
+ }
+ ],
external: ['async_hooks', 'cluster', 'events', 'os', 'worker_threads'],
plugins: [
typescript({
PromiseWorkerResponseWrapper
} from '../utility-types'
import { EMPTY_FUNCTION, EMPTY_OBJECT_LITERAL } from '../utils'
-import { isKillBehavior, KillBehaviors } from '../worker/worker-options'
+import { KillBehaviors, isKillBehavior } from '../worker/worker-options'
import type { PoolOptions } from './pool'
import { PoolEmitter } from './pool'
import type { IPoolInternal, TasksUsage } from './pool-internal'