tsproject icon indicating copy to clipboard operation
tsproject copied to clipboard

NOTICE: When bundling always wrap a collection of exported functions in an external namespace declaration

Open ToddThomson opened this issue 9 years ago • 0 comments

Since TsProject bundles ES6 external modules into a single javascript library, you cannot have a "loose" collection of functions( classes, variables, etc ) within a source file. Wrap the functions in an external module definition. For example:

instead of:

export foo() {}
export bar() {}

use:

export namespace foobar {
   export foo() {}
   export bar() {}
}

This should be added to the wiki documentation.

ToddThomson avatar Oct 29 '15 19:10 ToddThomson