Skip to content
This repository was archived by the owner on Oct 9, 2020. It is now read-only.
This repository was archived by the owner on Oct 9, 2020. It is now read-only.

Async/await is not working with this pattern #68

@rf00

Description

@rf00

This one works:

//boot.js
var main = require('./main.js')

main.boot()

//main.js

export async function boot() {
  await new Promise(function(resolve, reject) {
    console.log('hello world');
    setTimeout(function() {
      resolve();
    }, 1000);
  })
  console.log('hello world after 1s!');
}

This one works with webpack but systemjs:

//boot.js
var main = require('./main.js')

//main.js

(async function boot() {
  await new Promise(function(resolve, reject) {
    console.log('hello world');
    setTimeout(function() {
      resolve();
    }, 1000);
  })
  console.log('hello world after 1s!');
})()

Not sure is it an issue

Edit:
Works after adding this:
export var p = 5;
More precisely, in configuration:

meta: {
  './js/main.js': {
    format: 'esm'
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions