Skip to content
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

spack: Wrong import from regenerator-runtime #2789

Closed
fralonra opened this issue Nov 18, 2021 · 4 comments · Fixed by #2930
Closed

spack: Wrong import from regenerator-runtime #2789

fralonra opened this issue Nov 18, 2021 · 4 comments · Fixed by #2930
Labels
Milestone

Comments

@fralonra
Copy link

Describe the bug

When I bundle code with generators, spack always failed with the following output:

node:internal/process/promises:218
          triggerUncaughtException(err, true /* fromPromise */);
          ^

[Error: load_transformed failed

Caused by:
    0: failed to analyze module
    1: failed to resolve regenerator-runtime from /my/test.js
    2: index not found] {
  code: 'GenericFailure'
}

swc works well though.

Env
OS: macOS 10.12.1
node: v15.0.1
@swc/core: v1.2.107

Input code

function* test() {
  yield 1
  yield 2
}

Config

no .swcrc

Playground link

No response

Expected behavior

Compile the code and bundle it without errors.

Version

1.2.107

Additional context

No response

@fralonra fralonra added the C-bug label Nov 18, 2021
@kdy1
Copy link
Member

kdy1 commented Nov 18, 2021

You should install regenerator-runtime

@kdy1 kdy1 closed this as completed Nov 18, 2021
@fralonra
Copy link
Author

You should install regenerator-runtime

Thanks, after the installation, the bundling worked fine.

But the code still cannot execute, with the following error:

Uncaught TypeError: Cannot read properties of undefined (reading 'mark')

The output code:

// ......
// above are the code of regenerator-runtime
var { default: regeneratorRuntime1  } = load();
var _marked = regeneratorRuntime1.mark(test); // throws here
function test() {
    return regeneratorRuntime1.wrap(function test$(_ctx) {
        while(1)switch(_ctx.prev = _ctx.next){
            case 0:
                _ctx.next = 2;
                return 1;
            case 2:
                _ctx.next = 4;
                return 2;
            case 4:
            case "end":
                return _ctx.stop();
        }
    }, _marked);
}

@kdy1
Copy link
Member

kdy1 commented Nov 18, 2021

Seems like spack is doing something wrong.
I'll change the title.

@kdy1 kdy1 reopened this Nov 18, 2021
@kdy1 kdy1 changed the title spack: Error: load_transformed failed when using generators spack: Wrong import from regenerator-runtime Nov 18, 2021
@kdy1 kdy1 modified the milestones: v1.2.111, v1.2.112, v1.2.113 Nov 18, 2021
@kdy1 kdy1 modified the milestones: v1.2.113, v1.2.114, v1.2.115, v1.2.116 Nov 27, 2021
@kdy1 kdy1 closed this as completed in #2930 Dec 1, 2021
kdy1 added a commit that referenced this issue Dec 1, 2021
swc_bundler:
 - Update helpers to use interop for common js deps. (Closes #2789)
@swc-bot
Copy link
Collaborator

swc-bot commented Oct 20, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants