aurelia / bundler

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

Allow jspm dependency transpilation during bundling #172

Closed Mobe91 closed 4 years ago

Mobe91 commented 6 years ago

I have already asked on Stackoverflow about this.

I have a problem with bundling my JSPM dependencies using aurelia-bundler. One of my dependencies uses ES6 arrow functions which causes an error during minifcation of the bundle when uglify is executed.

I presume that I need to configure aurelia-bundler to transpile this dependency during bundling in order to make uglify work. The answers I received so far suggest that this is not possible using aurelia-bundler but only with aurelia-cli.

doktordirk commented 6 years ago

i guess the bundler only bundles. so, might be more a job of the build task, eg add a task to copy those deps over to /scr before build. given everything stays the same they'd end up in the app bundle though

Mobe91 commented 6 years ago

Yeah but that is not optimal because for copying the resources I would need to have hardcoded paths to the jspm_packages directory containing version information in my build instead of using config.js to resolve the paths in a version-independent way.

doktordirk commented 6 years ago

maybe something like https://www.npmjs.com/package/uglify-js-es6 is the better approach

Mobe91 commented 6 years ago

So how do I get aurelia-bundler to apply this es6 uglification?

doktordirk commented 6 years ago

same as with 'normal' uglify i'd guess. i mean, as i see it, uglify isn't included, you'd just add a new task which uglify-es6 the (maybe unminified) bundle

StrahilKazlachev commented 6 years ago

The js minification option is just proxied by aurelia-bundler to systemjs-builder. => which is using uglify-js => which does not support ES6 or newer, as stated in their repo:

uglify-js only supports JavaScript (ECMAScript 5).

Mobe91 commented 6 years ago

@StrahilKazlachev I guess there is no way to configure systemjs-builder to use a different uglification implementation and to tunnel this config through aurelia-bundler? 😃

If not, then 'manual' transpiling as a pre-processing step to bundling seems to be the only option, right? Do you know of any way to do this using config.js for dependency path resolution (to prevent hardcoded versions in paths)? I would need to:

EisenbergEffect commented 4 years ago

Closing this issue. The aurelia-bundler library has been superseded by the aurelia-cli.