This repository was archived by the owner on Apr 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -3,13 +3,34 @@ import type { Options } from 'tsup';
3
3
// eslint-disable-next-line import/no-extraneous-dependencies
4
4
import { defineConfig } from 'tsup' ;
5
5
6
+ /**
7
+ * Webpack unfortunately does not support the `node:` prefix making it impossible to polyfill the
8
+ * `node:stream` and `node:util` libraries that we use here so we're removing it when we generate
9
+ * our dists.
10
+ *
11
+ * @see {@link https://github.com/evanw/esbuild/issues/1760#issuecomment-964900401 }
12
+ * @see {@link https://github.com/webpack/webpack/issues/14166 }
13
+ */
14
+ const stripNodeColonPlugin = {
15
+ name : 'strip-node-colon' ,
16
+ setup ( { onResolve } ) {
17
+ onResolve ( { filter : / ^ n o d e : / } , args => {
18
+ return {
19
+ path : args . path . slice ( 'node:' . length ) ,
20
+ external : true ,
21
+ } ;
22
+ } ) ;
23
+ } ,
24
+ } ;
25
+
6
26
export default defineConfig ( ( options : Options ) => ( {
7
27
...options ,
8
28
9
29
cjsInterop : true ,
10
30
clean : true ,
11
31
dts : true ,
12
32
entry : [ 'src/index.ts' ] ,
33
+ esbuildPlugins : [ stripNodeColonPlugin ] ,
13
34
format : [ 'esm' , 'cjs' ] ,
14
35
minify : false ,
15
36
shims : true ,
You can’t perform that action at this time.
0 commit comments