|
1 |
| -import { defineConfig } from 'tsup' |
2 |
| -import path from 'path' |
3 |
| -import { fileURLToPath } from 'url' |
| 1 | +import { defineConfig } from "tsup"; |
| 2 | +import path from "path"; |
| 3 | +import { fileURLToPath } from "url"; |
4 | 4 |
|
5 |
| -const thisFile = fileURLToPath(new URL(import.meta.url)) |
6 |
| -const root = path.dirname(thisFile) |
| 5 | +const thisFile = fileURLToPath(new URL(import.meta.url)); |
| 6 | +const root = path.dirname(thisFile); |
7 | 7 |
|
8 | 8 | let replaceAssertPlugin = {
|
9 |
| - name: 'replace-assert', |
| 9 | + name: "replace-assert", |
10 | 10 | setup(build: any) {
|
11 | 11 | // Resolve `assert` to a blank file
|
12 | 12 | build.onResolve({ filter: /^assert$/ }, (args: any) => {
|
13 |
| - return { path: path.join(root, 'src', 'polyfills', 'blank.ts') } |
14 |
| - }) |
| 13 | + return { path: path.join(root, "src", "polyfills", "blank.ts") }; |
| 14 | + }); |
15 | 15 | },
|
16 |
| -} |
| 16 | +}; |
17 | 17 |
|
18 | 18 | const entryPoints = [
|
19 |
| - 'src/index.ts', |
20 |
| - 'src/worker/index.ts', |
21 |
| - 'src/worker/process.ts', |
22 |
| - 'src/vector/index.ts', |
23 |
| -] |
| 19 | + "src/index.ts", |
| 20 | + "src/worker/index.ts", |
| 21 | + "src/worker/process.ts", |
| 22 | + "src/vector/index.ts", |
| 23 | +]; |
24 | 24 |
|
25 | 25 | export default defineConfig({
|
26 | 26 | entry: entryPoints,
|
27 | 27 | sourcemap: true,
|
28 | 28 | dts: {
|
29 | 29 | entry: entryPoints,
|
30 |
| - resolve: true |
| 30 | + resolve: true, |
31 | 31 | },
|
32 | 32 | clean: true,
|
33 |
| - format: ['esm'], |
| 33 | + format: ["esm"], |
34 | 34 | esbuildOptions(options, context) {
|
35 |
| - options.inject = ['src/polyfills/buffer.ts'] |
| 35 | + options.inject = [ |
| 36 | + "src/polyfills/buffer.ts", |
| 37 | + "src/polyfills/indirectEval.ts", |
| 38 | + ]; |
36 | 39 | },
|
37 |
| - esbuildPlugins: [ |
38 |
| - replaceAssertPlugin, |
39 |
| - ], |
| 40 | + esbuildPlugins: [replaceAssertPlugin], |
40 | 41 | minify: true,
|
41 |
| -}) |
| 42 | +}); |
0 commit comments