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 = {
1313 output : {
1414 path : path . resolve ( __dirname , "dist" ) ,
1515 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.
1623 libraryTarget : "commonjs2" ,
1724 clean : {
25+ // We emit types separately so if they are in the output directory
26+ // we want to keep them.
1827 keep : "types" ,
1928 } ,
2029 } ,
2130 resolve : {
2231 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.
2336 extensionAlias : {
2437 ".js" : [ ".ts" , ".js" ] ,
2538 ".mjs" : [ ".mts" , ".mjs" ] ,
You can’t perform that action at this time.
0 commit comments