aurelia / bundler

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

Cannot target native async/await #161

Closed timfish closed 7 years ago

timfish commented 7 years ago

I am trying to target the latest electron which has native async/await but I can't get bundling working at all due to https://github.com/systemjs/builder/issues/726

I'm using these settings:

      "options": {
        "inject": true,
        "minify": false,
        "depCache": false,
        "rev": false,
        "sourceMaps": true,
        "sourceMapContents": true
      }

Top of my config.js

System.config({
  defaultJSExtensions: true,
  transpiler: false,
  paths: {
    "*": "dist/*",
    "github:*": "jspm_packages/github/*",
    "npm:*": "jspm_packages/npm/*"
  },
  map: {

And the TypeScript compiler is targeting:

    "target": "esnext",
    "module": "system",

SystemJS handles this all fine when running in development and loading all the files individually.

But on bundling I get the following error:

        (SystemJS) Unexpected identifier
        C:/Users/tim/Documents/some-path/dist/alarms/alarm-list.js!transpiled:45
                        async addAlarm() {
                              ^^^^^^^^
        SyntaxError: Unexpected identifier
timfish commented 7 years ago

Even with minify: false bundling with ES6+ features fails and this is apparently because the 0.15 branch of systemjs-builder still runs code through Traceur even with minify disabled.

Was there a reason (other than time constraints) that aurelia-bundler was never updated to systemjs-builder@0.16?

I'm currently working on a pull request for systemjs-builder which updates to the latest uglify.

ahmedshuhel commented 7 years ago

@timfish No, there's no reason to stay with v0.15 of the builder. Updating the version and will push the code out.

ahmedshuhel commented 7 years ago

@timfish also will be nice if you submit a PR here after systemjs-builder get's updated with latest uglifyjs.

timfish commented 7 years ago

@ahmedshuhel Yes, will do. The PR should end up on systemjs-builder@0.16 and then I'll submit one here.

ahmedshuhel commented 7 years ago

No problem. I will be updating the bundler to systemjs-builder@0.16 in the meantime.

ahmedshuhel commented 7 years ago

@timfish upgraded to systemjs-builder@0.16.9 and pushed a release out. Let us know if that fixes the problem.

jp7677 commented 7 years ago

Hi there, could it be that the update to systemjs-builder 0.16 implies that jspm 0.16 is no longer supported and one has to move to jspm 0.17 beta?

My bundle works fine with aurelia-bundler 0.6.0 in a jspm 0.16 project, but the bundle is invalid once I update to 0.6.1 or newer. This is my error:

Error: (SystemJS) Cannot read property 'get' of undefined
at
var _retrieveGlobal = System.registry.get("@@global-helpers").prepareGlobal($__module.id, null, null);

This could relate to the breaking changes in systemjs-builder 0.16 (https://github.com/systemjs/builder/releases/tag/0.16.0) in favour of systemjs 0.20. Jspm 0.16 still uses systemjs 0.19 :(

timfish commented 7 years ago

@ahmedshuhel Turns out there was a reason that the dependency was never updated!

aurelia-bundler@0.6.2 Cannot build bundles for SystemJS @ 0.19. System.registry.get was introduced in 0.20

ahmedshuhel commented 7 years ago

@jp7677 @timfish I will look into it.

nick-janda commented 5 years ago

I'm having this exact issue. I have SystemJS 0.19, but when running bundled I have four dependencies that try to use System.registry.get("@@global-helpers...") which is a SystemJS 0.20 thing. I hope I don't have to upgrade to jspm 0.17, which is still in beta? I gave it a quick try a few weeks ago with disastrous results. Are you guys still looking into this?