Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Build using existing System.register bundles #838

Open
matthewjh opened this issue Dec 26, 2017 · 0 comments
Open

Build using existing System.register bundles #838

matthewjh opened this issue Dec 26, 2017 · 0 comments

Comments

@matthewjh
Copy link

Hello,

I have an existing System.js bundle (that is, a single file containing many System.register calls) that is produced by the TypeScript compiler with module="System". What I want to do is build some new bundles from subtrees of the modules represented in this file. For example, say my TS-generated bundle file contains modules A, B, and C. I want to use the System.js builder to build new two bundles using A and B respectively as entry points.

I tried to do this using the "bundles" config property without any luck:

var path = require("path");
var Builder = require('systemjs-builder');


function build () {
    var builder = new Builder(
        undefined,
        "build/renderer-system-config.js"
    );
    builder.bundle("renderer/index", "out-lol.js")
        .then(() => {
            console.log("build success");
        })
        .catch(e => {
            console.error(e);
        });
}

build(); 

renderer-system-config.js

SystemJS.config({
    baseURL: "src",
    bundles: {
        "renderer/out.js": ["renderer/index"]
    }
});

renderer/out.js contains

System.register("renderer/index", .... );

and a bunch of other System.register'd modules.

My expectation was that thanks to the "bundle" property in my config, when I call builder.bundle("renderer/index", ...), System.js would go and fetch renderer/out.js. This seems not to be the case:

 Error on fetch for renderer/index at file:///D:/a/b/src/renderer/index
        Error: ENOENT: no such file or directory, open 'D:\a\b\src\renderer\index'
    at Error (native)
  originalErr:
   { Error: ENOENT: no such file or directory, open 'D:\a\b\src\renderer\index'
       at Error (native)
     errno: -4058,
     code: 'ENOENT',
     syscall: 'open',
     path: 'D:\\a\\b\\src\\renderer\\index' } }

Does anyone know the right way to approach this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant