Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing package in bundle #115

Closed
lukeapage opened this issue Jun 24, 2015 · 11 comments
Closed

Missing package in bundle #115

lukeapage opened this issue Jun 24, 2015 · 11 comments

Comments

@lukeapage
Copy link

full source code here - https://github.com/less/less-preview

my Aurelia file looks like this

aurelia.command('bundle', {
  js: {
    'dist/app-bundle': {
      modules: [
        '*',
        "aurelia-dependency-injection",
        "aurelia-event-aggregator",
        "aurelia-framework",
        "aurelia-loader-default",
        "aurelia-logging-console",
        "aurelia-templating-binding",
        "aurelia-templating-resources",
        "codemirror",
        "polymer/mutationobservers"
      ],
      options: {
        inject: true,
        minify: true
      }
    }
  },

now, aurelia-loader-default references aurelia-loader, which references web componentjs (from the config.js file)

    "github:aurelia/loader-default@0.8.0": {
      "aurelia-loader": "github:aurelia/loader@0.7.0",
      "aurelia-metadata": "github:aurelia/metadata@0.6.0"
    },
    "github:aurelia/loader@0.7.0": {
      "aurelia-html-template-element": "github:aurelia/html-template-element@0.2.0",
      "aurelia-path": "github:aurelia/path@0.7.0",
      "core-js": "npm:core-js@0.9.15",
      "webcomponentsjs": "github:webcomponents/webcomponentsjs@0.6.3"
    },

and that gets downloaded...

webcomponentjsdownloaded

and when I run in chrome all is fine, but it seems at least some of the files (HTMLImports.min.js) are not included in the bundle, so in firefox, the site fails to load because the file is not bundled.

mozilla-error

Shouldn't it be included as a sub dependency? is it because it is an optional polyfill?

@ahmedshuhel
Copy link
Contributor

Polyfills are loaded when necessary. For now, could you try including it in the bundle explicitly and see if it works?

@lukeapage
Copy link
Author

so after alot of trial and error, I got it to work by putting this into my module list in the aurelia file - "github:webcomponents/webcomponentsjs@0.6.3/*"

My first attempt was "webcomponents/webcomponentsjs", then "webcomponentsjs" then "github:webcomponents/webcomponentsjs@0.6.3" then "github:webcomponents/webcomponentsjs@0.6.3/HTMLImports.min.js" before finally finding the * worked.

Next I tried IE and that was missing "aurelia-html-template-element" so I tried "github:aurelia/html-template-element@^0.2.0/*" which included the package in the bundle, but it didn't get picked up because it was required as "aurelia-html-template-element", so to get it to work I had to jspm install it as a root dependency and then add "aurelia-html-template-element" to my AureliaFile...

I think you really need a includeOptional option..

@lukeapage
Copy link
Author

Note: this includes the minified and non minified version of the files!!!

@lukeapage
Copy link
Author

aha, got it to work with including a single file by omitting the extension - "github:webcomponents/webcomponentsjs@0.6.3/HTMLImports.min"

@lukeapage
Copy link
Author

new definition is this:

aurelia.command('bundle', {
  js: {
    'dist/app-bundle': {
      modules: [
        '*',
        "aurelia-dependency-injection",
        "aurelia-event-aggregator",
        "aurelia-framework",
        "aurelia-loader-default",
        "aurelia-logging-console",
        "aurelia-templating-binding",
        "aurelia-templating-resources",
        "aurelia-html-template-element",
        "codemirror",
        "polymer/mutationobservers",
        "github:webcomponents/webcomponentsjs@0.6.3/HTMLImports.min",
      ],
      options: {
        inject: true,
        minify: true
      }
    }
  }

@alexisargyris
Copy link

@lukeapage when you don't bundle your app, is firefox working? Did you need to do anything extra in comparison to chrome?

@lukeapage
Copy link
Author

@alexisargyris yes it is - I just checked. Feel free to browse my source code and nick anything you need (it was based on the skeleton code)

@alexisargyris
Copy link

Thanks. That boostrapper.js looks very-very interesting

@lukeapage
Copy link
Author

Thanks. That boostrapper.js looks very-very interesting

Ah, its not actually - I took aurelia-bootstrap and removed references to router and http - so its a straight fork with removals. I had problems setting the url if the router was included, even if it wasn't setup and as a bonus I don't get those modules included in the bundle. I hope Aurelia will become more configurable in terms of including/excluding bits and not having them included at all, then I can drop it. If I can get the url changing working I might switch back to aurelia-bootstrap anyway just for ease of maintainability and take the hit on the extra bundle bytes (which I guess aren't that much)

@plwalters
Copy link
Contributor

Interesting about the bootstrapper - I'm not sure whether it would make sense to have multiple bootstrappers or to have one which conditionally loads things but consider releasing this on jspm as something like bootstrapper-lite

@alexisargyris
Copy link

update: the problem with firefox (when the app is not bundled) is present only in the developer edition for some reason.

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

No branches or pull requests

5 participants