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

Allow jspm dependency transpilation during bundling #172

Open
Mobe91 opened this Issue Jul 2, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@Mobe91
Copy link

Mobe91 commented Jul 2, 2018

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

This comment has been minimized.

Copy link

doktordirk commented Jul 2, 2018

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

This comment has been minimized.

Copy link

Mobe91 commented Jul 3, 2018

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

This comment has been minimized.

Copy link

doktordirk commented Jul 3, 2018

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

@Mobe91

This comment has been minimized.

Copy link

Mobe91 commented Jul 3, 2018

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

@doktordirk

This comment has been minimized.

Copy link

doktordirk commented Jul 3, 2018

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

This comment has been minimized.

Copy link

StrahilKazlachev commented Jul 3, 2018

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

This comment has been minimized.

Copy link

Mobe91 commented Jul 3, 2018

@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:

  • Resolve path to dependency
  • Pass dependency sources to uglify and output it to some temp/build directory in my workspace
  • Refer to this temp/build directory during bundling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment