aurelia / bundler

A library for bundling JavaScript, HTML and CSS for use with SystemJS.
MIT License
37 stars 25 forks source link

The files in the library folder of core-js is not bundling correctly #110

Closed jithinoj closed 8 years ago

jithinoj commented 8 years ago

We have developed aurelia applicaton. We have bundling is done through gulp. The files in the “core-js” module(core-js@2.1.1/modules) folder are bundled correctly but the files in the library(core-js@2.1.1/library) folder is not bundling. We have using core-js@2.1.0 and core-js@2.1.1 versions.

EisenbergEffect commented 8 years ago

Can you provide more information on your bundling setup? Your configuration may be incorrect. Also, if you are using the full core-js, you may want to consider mapping that to the shim.min version in the client folder of that library which will give you a single module with all polyfills.

jithinoj commented 8 years ago

The bundle.json

{ "force": true, "bundles": { "dist/aurelia": { "includes": [ "aurelia-binding", "aurelia-bootstrapper", "aurelia-logging-console", "aurelia-breeze", "aurelia-dependency-injection", "aurelia-dialog", "aurelia-event-aggregator", "aurelia-framework", "aurelia-history", "aurelia-history-browser", "aurelia-http-client", "aurelia-i18n", "aurelia-loader", "aurelia-loader-default", "aurelia-logging", "aurelia-metadata", "aurelia-path", "aurelia-pal-browser", "aurelia-route-recognizer", "aurelia-router", "aurelia-task-queue", "aurelia-templating", "aurelia-templating-binding", "aurelia-templating-resources", "aurelia-templating-router", "aurelia-validation", "babel", "bootstrap", "breeze", "core-js", "clean-css", "css", "i18next", "jquery", "moment", "ms-signalr-client", "text", "toastr" ], "options": { "inject": true, "minify": true, "rev": true } }, "dist/app-build": { "includes": [ "[_//.js]", ".html!text", ".css!text" ], "options": { "inject": true, "minify": true, "rev": true } }, "dist/app-bundle": { "includes": [ "//.html", ".html!text", "_.css!text" ], "options": { "inject": true, "minify": true, "rev": true } } } }

bundle.js

var gulp = require('gulp'); var bundler = require('aurelia-bundler'); var bundles = require('../bundles.json'); var replace = require('gulp-replace'); var runSequence = require('run-sequence');

var config = { force: true, baseURL: '.', configPath: './config.js', bundles: bundles.bundles };

gulp.task('bundle', function (callback) { runSequence('unbundle', 'bundle-config', 'copy-app-files', 'compress',
function () {

            });

});

gulp.task('unbundle', function () {

return bundler.unbundle(config)
            .then(function () {
                gulp.src('config.js')
                    .pipe(replace('dist', 'src'))
                    .pipe(gulp.dest(''));
            });

});

gulp.task('bundle-config', function () { return gulp.src('config.js') .pipe(replace('src', 'dist')) .pipe(gulp.dest('')); });

gulp.task('compress', function () { return bundler.bundle(config); });

gulp.task('copy-app-files', function () { return gulp.src('src/*/.{html,js}') .pipe(gulp.dest('dist')); });

EisenbergEffect commented 8 years ago

That's surprising. For some reason system builder must not be able to trace the dependencies of the core-js library. Have you tried remapping it in the config.js so that it just brings in the single file shim library?

@ahmedshuhel Do you know anything about this?

jithinoj commented 8 years ago

Config.js

"npm:core-js@2.1.0": { "fs": "github:jspm/nodelibs-fs@0.1.2", "path": "github:jspm/nodelibs-path@0.1.0", "process": "github:jspm/nodelibs-process@0.1.2", "systemjs-json": "github:systemjs/plugin-json@0.1.0" }, "npm:core-js@2.1.1": { "fs": "github:jspm/nodelibs-fs@0.1.2", "path": "github:jspm/nodelibs-path@0.1.0", "process": "github:jspm/nodelibs-process@0.1.2", "systemjs-json": "github:systemjs/plugin-json@0.1.0" },

jithinoj commented 8 years ago

How can we remap the 'client/shim.min.js' in the config.js ,Please give the details regarding this

EisenbergEffect commented 8 years ago

One of the simplest things you can do is add this to your package.json

"overrides": {
      "npm:core-js@1.2.6": {
        "main": "client/shim.min"
      }
    }

Then re-install core-js. jspm will set everything up for you. Then you should just need to ensure that core-js gets bundled by including it in your bundle. If you are using the latest Aurelia though, you should know that you don't need core-hs unless you are using additional Polyfills not provided by our polyfill library.