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

Bundling with systemjs-builder doens't include the css file content #118

Description

@eberlitz

Hi,

After updating plugin-css from 0.1.23 to 0.1.32, when I build the application throught the systemjs-builder the bundles doens't include the content from my css files and I don't know why.

Here is how I'm bundling using a node script:

var jspm = require('jspm');
var Builder = require('systemjs-builder');
jspm.setPackagePath('.');

var builder = new Builder('./client', './client/config.js');

builder.config({
    separateCSS: false,
    buildCSS: true
});

var bundleOpts = {
    sourceMaps: false,
    minify: true,
    mangle: true,
    runtime: false,
    normalize: true
};

builder.bundle('lib/main', './dist/bundle-main.js', bundleOpts);

builder.bundle('lib/feat1.ts - lib/main', './dist/bundle-feat1.js', bundleOpts);
// builder.bundle('lib/feat2.ts - lib/main', './dist/bundle-feat2.js', bundleOpts);

My css SystemJS config related:

    System.config({
        map: {
            "css": "github:systemjs/plugin-css@0.1.32"
        },
        packages: {
            "app": {
                "meta": {
                    "*.css": { "loader": "css" }
                }
            }
        }
    });

The resulting bundles:

bundle-main.js:

System.registerDynamic("lib/site.css", [], !1, function(a, b, c) {
    var d = System.get("@@global-helpers").prepareGlobal(c.id, null, null);
    return function(a) {}(this), d()
}), System.register("lib/main.ts", ["lib/site.css"], function(a, b) {
    "use strict";
    b && b.id;
    return {
        setters: [function(a) {}],
        execute: function() {
            alert("ok")
        }
    }
});

bundle-feat1.js:

System.registerDynamic("lib/feat1.css", [], !1, function(a, b, c) {
        var d = System.get("@@global-helpers").prepareGlobal(c.id, null, null);
        return function(a) {}(this), d()
    }), System.register("lib/feat1.ts", ["lib/feat1.css"], function(a, b) {
        "use strict";
        b && b.id;
        return {
            setters: [function(a) {}],
            execute: function() {}
        }
    }),
    function(a) {
        if ("undefined" != typeof document) {
            var b = document,
                c = "appendChild",
                d = b.createElement("style");
            d.type = "text/css", b.getElementsByTagName("head")[0][c](d), d[c](b.createTextNode(a))
        }
    }("body,html{margin:0;padding:0;height:100%;width:100%;background-color:#20b2aa}body{background-color:red}\n/*# sourceMappingURL=__.css.map */");

As seen, the css from the main bundle got strangely concatenated into the feat1 bundle. This broke my current application as I lazy load bundles by features.

Any clues? Don't know whats happening here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions