@@ -190,7 +190,6 @@ async function runDtsBundler(entrypoint, output) {
190
190
* @typedef BundlerTaskOptions
191
191
* @property {string[] } [external]
192
192
* @property {boolean } [exportIsTsObject]
193
- * @property {boolean } [setDynamicImport]
194
193
* @property {boolean } [treeShaking]
195
194
*/
196
195
function createBundler ( entrypoint , outfile , taskOptions = { } ) {
@@ -257,22 +256,12 @@ function createBundler(entrypoint, outfile, taskOptions = {}) {
257
256
} ;
258
257
259
258
if ( taskOptions . exportIsTsObject ) {
260
- // These snippets cannot appear in the actual source files, otherwise they will be rewritten
261
- // to things like exports or requires.
262
-
259
+ // We use an IIFE so we can inject the footer, and so that "ts" is global if not loaded as a module.
260
+ options . format = "iife" ;
261
+ // Name the variable ts, matching our old big bundle and so we can use the code below.
262
+ options . globalName = "ts" ;
263
263
// If we are in a CJS context, export the ts namespace.
264
- let footer = `\nif (typeof module !== "undefined" && module.exports) { module.exports = ts; }` ;
265
-
266
- if ( taskOptions . setDynamicImport ) {
267
- // If we are in a server bundle, inject the dynamicImport function.
268
- // This only works because the web server's "start" function returns;
269
- // the node server does not, but we don't use this there.
270
- footer += `\nif (ts.server && ts.server.setDynamicImport) { ts.server.setDynamicImport(id => import(id)); }` ;
271
- }
272
-
273
- options . format = "iife" ; // We use an IIFE so we can inject the footer, and so that "ts" is global if not loaded as a module.
274
- options . globalName = "ts" ; // Name the variable ts, matching our old big bundle and so we can use the code below.
275
- options . footer = { js : footer } ;
264
+ options . footer = { js : `\nif (typeof module !== "undefined" && module.exports) { module.exports = ts; }` } ;
276
265
}
277
266
278
267
return options ;
@@ -416,7 +405,7 @@ const { main: tsserver, watch: watchTsserver } = entrypointBuildTask({
416
405
// this is used in the browser too. Do the same thing that we do for our
417
406
// libraries and generate an IIFE with name `ts`, as to not pollute the global
418
407
// scope.
419
- bundlerOptions : { exportIsTsObject : true , setDynamicImport : true } ,
408
+ bundlerOptions : { exportIsTsObject : true } ,
420
409
} ) ;
421
410
export { tsserver , watchTsserver } ;
422
411
0 commit comments