ts-global-module-loader

1.0.4 • Public • Published

exports Typescript commonjs global compiled files to be written on window for webpack

Installation

npm install ts-global-module-loader

Usage

For code that generated from Typescript that looks like that:

var services;
(function (services) {
    var Foo = (function () {
        function Foo() {
        }
        return Foo;
    }());
    services.Foo = Foo;
})(services || (services = {}));
require("ts-global-module-loader?./file.js");

will modify the code file's source to:

var services = window["services"];
(function (services) {
    var Foo = (function () {
        function Foo() {
        }
        return Foo;
    }());
    services.Foo = Foo;
})(services || (services = {}));
window["services"] = (services);

Inspired by https://github.com/webpack/exports-loader;

Documentation: Using loaders

License

MIT (http://www.opensource.org/licenses/mit-license.php)

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i ts-global-module-loader

    Weekly Downloads

    5

    Version

    1.0.4

    License

    none

    Unpacked Size

    2.99 kB

    Total Files

    3

    Last publish

    Collaborators

    • felixmosh