aurelia / bundler

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

Exclude external dependencies #85

Closed StrahilKazlachev closed 8 years ago

StrahilKazlachev commented 8 years ago

I may be doing this completely wrong to start with. So how should I map a "library" that is relative to the host and exclude it when bundling? This is my config: In config.js

  paths: {
    "alias*": "/some-path/*"
  },
  map: {
    "lib": "alias/some-lib"
  }

In bundle config "excludes": ["lib"] But I get the following error:

Error: Error on fetch for alias/some-lib.js at file:///some-path//some-lib.js
    ENOENT: no such file or directory, open 'd:\github\aurelia\skeleton-navigation\skeleton-es2016\some-path\some-lib.js'
    at Error (native)
ahmedshuhel commented 8 years ago

Is this file 'd:\github\aurelia\skeleton-navigation\skeleton-es2016\some-path\some-lib.js' really exists in the file system?

StrahilKazlachev commented 8 years ago

No it doesn't. By external I wanted to say that the file does not exist in the project/file system. Finally managed to do it. If someone stumbles upon this use case: In config.js

paths: {
  lib: "/some-path/some-lib.js"
},
meta: {
  "/some-path/some-lib.js": {
    build: false
  }
}

@ahmedshuhel As I get it this config option is systemjs builder specific. I hope when/if the bundler stops using systemjs builder this scenario will be supported in some way.

EisenbergEffect commented 8 years ago

@StrahilKazlachev Perhaps you would be interested in making a PR to our bundler docs with a note on this? They are in the framework repo, doc folder.

@ahmedshuhel Please make a note about this. Any future solutions definitely need to account for this use case.

StrahilKazlachev commented 8 years ago

@EisenbergEffect Will do, I'll try by the end of the week.

StrahilKazlachev commented 8 years ago

Some additional info. It tuns out that since systemjs builder 0.15.0 there is an option that automatically takes care of my use case. But for that to work one should not add the module in question to the excludes of the bundle config, as I was doing, because this causes the error from my first comment.