File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -13,13 +13,26 @@ module.exports = {
13
13
output : {
14
14
path : path . resolve ( __dirname , "dist" ) ,
15
15
filename : "[name].cjs" ,
16
+ // For both cli and lib, we want to output CommonJS modules because
17
+ // vscode extension unfortunately still uses classic node module
18
+ // resolution and to be able to use our mcp exports there we need to
19
+ // compile to CommonJS.
20
+ //
21
+ // The CLI entrypoint does not care if its CommonJS
22
+ // or ESM so to keep configuration simple we compile both to CommonJS.
16
23
libraryTarget : "commonjs2" ,
17
24
clean : {
25
+ // We emit types separately so if they are in the output directory
26
+ // we want to keep them.
18
27
keep : "types" ,
19
28
} ,
20
29
} ,
21
30
resolve : {
22
31
extensions : [ ".ts" , ".js" ] ,
32
+ // This is necessary because our repo is a module and that requires us
33
+ // to write complete path imports. This however does not resolve
34
+ // correctly when inside the bundler which is why we use the
35
+ // extensionAlias.
23
36
extensionAlias : {
24
37
".js" : [ ".ts" , ".js" ] ,
25
38
".mjs" : [ ".mts" , ".mjs" ] ,
You can’t perform that action at this time.
0 commit comments