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

Plugins not working #181

Closed
laytong opened this issue May 10, 2023 · 8 comments
Closed

Plugins not working #181

laytong opened this issue May 10, 2023 · 8 comments

Comments

@laytong
Copy link

laytong commented May 10, 2023

Using
"swc-loader": "^0.2.3",
"@swc/core": "1.3.55",

and any of
"@swc/plugin-emotion": "^2.5.61",
"@swc/plugin-transform-imports": "^1.5.61",

Causes my webpack/swc-loader build to fail with

Module build failed (from ./node_modules/swc-loader/src/index.js):
Error: failed to handle: failed to invoke plugin: failed to invoke plugin on 'Some("/Users/<some path>/src/index.ts")'

Caused by:
    0: failed to invoke `@swc/plugin-transform-imports` as js transform plugin at node_modules/@swc/plugin-transform-imports/swc_plugin_transform_imports.wasm
    1: RuntimeError: unreachable
           at <unnamed> (<module>[4103]:0x14d52d)
           at <unnamed> (<module>[4094]:0x14d26b)
           at <unnamed> (<module>[4093]:0x14d232)
           at <unnamed> (<module>[4081]:0x14c2e0)
           at <unnamed> (<module>[4080]:0x14c20a)
           at <unnamed> (<module>[4088]:0x14c89e)
           at <unnamed> (<module>[4238]:0x15b5b7)
           at <unnamed> (<module>[4283]:0x161ec2)
           at <unnamed> (<module>[413]:0x4d30c)
           at <unnamed> (<module>[4417]:0x169feb)
    2: unreachable

.swcrc

{
  "$schema": "https://json.schemastore.org/swcrc",

  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true
    },
    
    "baseUrl": ".",
    "paths": {
      "gql": ["src/gql"],
      "providers": ["src/providers"],
      "icons": ["src/icons"],
      "public": ["public"],
      "images": ["public/images"]
    },
    "target": "es2020",
    "transform": {
      "react": {
        "runtime": "automatic"
      }
    }
  }
}

If I introduce a plugin i.e.

"experimental": {
      "plugins": [
        [
          "@swc/plugin-emotion",
          {
            "sourceMap": true,
            "autoLabel": "dev-only",
            "labelFormat": "[local]"
          }
        ]
      ]
    },
@laytong
Copy link
Author

laytong commented May 10, 2023

It looks like it's actually being broken by a patch version of @swc/core 1.3.57
1.3.55 appears to work for @swc/plugin-emotion

@swc/plugin-transform-paths appears to error out with

Error: failed to handle: called `Result::unwrap()` on an `Err` value: PoisonError { .. }

Which is a duplicate of
swc-project/swc-loader#75

@kdy1
Copy link
Member

kdy1 commented May 11, 2023

cc @kwonoj

@kwonoj
Copy link
Member

kwonoj commented May 11, 2023

maybe [email protected] regression?

@kdy1
Copy link
Member

kdy1 commented May 11, 2023

@justinbhopper
Copy link

I am finding similar -- the problem begins at v1.5.47 and above. This appears to be when swc core was upgraded.

8777247

@BiscuiTech
Copy link

BiscuiTech commented May 12, 2023

Seems to cause similar errors with @swc/plugin-styled-components

Module build failed (from ./node_modules/swc-loader/src/index.js):
Error: failed to handle: failed to invoke plugin: failed to invoke plugin on 'Some("C:\\cbcsrc\\Info\\node_modules\\@cbcradcan\\vcinq\\vcinq-react\\src\\server\\start.ts")'

Caused by:
    0: failed to invoke `@swc/plugin-styled-components` as js transform plugin at node_modules\@swc\plugin-styled-components\swc_plugin_styled_components.wasm
    1: RuntimeError: unreachable
           at <unnamed> (<module>[3390]:0x116117)
           at <unnamed> (<module>[3385]:0x115f45)
           at <unnamed> (<module>[3384]:0x115f14)
           at <unnamed> (<module>[3371]:0x1150b4)
           at <unnamed> (<module>[3370]:0x114fe1)
           at <unnamed> (<module>[3379]:0x1157b6)
           at <unnamed> (<module>[3522]:0x123b0e)
           at <unnamed> (<module>[3570]:0x12a4c8)
           at <unnamed> (<module>[115]:0x1db7d)
           at <unnamed> (<module>[112]:0x1c5c7)
           at <unnamed> (<module>[138]:0x253e3)
           at <unnamed> (<module>[30]:0x59e6)
           at <unnamed> (<module>[114]:0x1d583)
           at <unnamed> (<module>[112]:0x1c547)
           at <unnamed> (<module>[138]:0x253e3)
           at <unnamed> (<module>[29]:0x56ec)
           at <unnamed> (<module>[28]:0x44f7)
           at <unnamed> (<module>[27]:0x442d)
           at <unnamed> (<module>[333]:0x43274)
           at <unnamed> (<module>[3680]:0x13178d)

Versions:
@swc/core: tried 1.3.57, 1.3.55 & 1.3.56
@swc/plugin-styled-components: tried 1.5.621.5.61 & 1.5.47

Edit: there seems to be sweet spot with core @ 1.3.56 and the plugin at 1.5.62.

@SevereCloud
Copy link

SevereCloud commented May 16, 2023

Error: failed to handle: called `Result::unwrap()` on an `Err` value: PoisonError { .. }

I have the same problem(@swc/[email protected] ~). The workaround is to run synchronously(--sync for @swc/cli)

@kwonoj
Copy link
Member

kwonoj commented May 26, 2023

I believe wasmer@3 upgrade related failures are reasonably resolved.

@kwonoj kwonoj closed this as completed May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants