JSPM Bundle with TypeScript transpiler

前端 未结 2 1061
无人及你
无人及你 2021-02-04 10:27

I\'m getting more into System.js and JSPM, where I\'ve come to the point where I want to bundle my TypeScript source code into a JavaScript bundle.

Now I can bundle my g

2条回答
  •  天命终不由人
    2021-02-04 10:53

    You can do it with JSPM builder. You can bundle all typescript files and bundlesfx to one single file, configurating jspm.conf.js like that:

    System.config({
        defaultJSExtensions: true,
        transpiler: "typescript",
        typescriptOptions: {
            "module": "amd",
            "experimentalDecorators": true
        },
        ...
        packages: {
            "app": {
                "main": "index",
                "defaultExtension": "ts",
                "meta": {
                    "*.ts": {
                        "loader": "ts"
                    }
                }
            }
    });
    

    and then run :

    jspm bundle-sfx src/index dist/app.js
    

    You can see full workign example in here: https://github.com/b091/ts-skeleton/

提交回复
热议问题