Skip to content

Commit

Permalink
fix(terser): __filename not defined (#1367)
Browse files Browse the repository at this point in the history
* fix(terser): __filename not defined

* fix(terser): transpiling esm syntax + prevented unknown options for terser
  • Loading branch information
tada5hi authored Dec 21, 2022
1 parent fcf13f7 commit 7259979
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/packages/babel/ @Andarist
/packages/image/ @tjenkinson
/packages/node-resolve/ @tjenkinson
/packages/terser/ @tada5hi
10 changes: 7 additions & 3 deletions packages/terser/src/module.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { fileURLToPath } from 'url';

import type { NormalizedOutputOptions, RenderedChunk } from 'rollup';
import { hasOwnProperty, isObject, merge } from 'smob';

import type { Options } from './type';
import { WorkerPool } from './worker-pool';

export default function terser(options: Options = {}) {
export default function terser(input: Options = {}) {
const { maxWorkers, ...options } = input;

const workerPool = new WorkerPool({
filePath: __filename,
maxWorkers: options.maxWorkers
filePath: fileURLToPath(import.meta.url),
maxWorkers
});

return {
Expand Down
3 changes: 2 additions & 1 deletion packages/terser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", "types/**/*"],
"compilerOptions": {
"noUnusedParameters": false
"noUnusedParameters": false,
"module": "ESNext"
}
}

0 comments on commit 7259979

Please sign in to comment.