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

Unable to create a working plugin based on https://swc.rs/docs/plugin/ecmascript/getting-started #8504

Closed
Artur- opened this issue Jan 15, 2024 · 2 comments · Fixed by #8508

Comments

@Artur-
Copy link

Artur- commented Jan 15, 2024

Describe the bug

cargo install swc_cli
swc plugin new --target-type wasm32-wasi my-first-plugin
rustup target add wasm32-wasi
cd my-first-plugin
cargo build-wasi --release

results in

   Compiling my-first-plugin v0.1.0 (/.../my-first-plugin)
error: no rules expected the token `r#"console.log("transform");"#`
   --> src/lib.rs:47:5
    |
47  |     r#"console.log("transform");"#
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no rules expected this token in macro call
    |
note: while trying to match `ok_if_code_eq`
   --> /.../.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_testing-0.138.10/src/lib.rs:415:61
    |
415 |     ($syntax:expr, $tr:expr, $test_name:ident, $input:expr, ok_if_code_eq) => {
    |                                                             ^^^^^^^^^^^^^

error: could not compile `my-first-plugin` (lib) due to previous error

Input code

No response

Config

No response

Playground link (or link to the minimal reproduction)

SWC Info output

Operating System:
    Platform: darwin
    Arch: arm64
    Machine Type: arm64
    Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000
    CPU: (10 cores)
        Models: Apple M1 Max

Binaries:
    Node: 20.9.0
    npm: 10.1.0
    Yarn: N/A
    pnpm: N/A

Relevant Packages:
    @swc/core: N/A
    @swc/helpers: N/A
    @swc/types: N/A
    typescript: 5.2.2

SWC Config:
    output: N/A
    .swcrc path: N/A

Next.js info:
    output: N/A

Expected behavior

The plugin builds

Actual behavior

No response

Version

?

Additional context

No response

@Artur- Artur- added the C-bug label Jan 15, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 15, 2024
@kdy1 kdy1 reopened this Jan 15, 2024
@swc-project swc-project deleted a comment from github-actions bot Jan 15, 2024
@swc-project swc-project unlocked this conversation Jan 15, 2024
@kdy1 kdy1 added this to the Planned milestone Jan 16, 2024
kdy1 added a commit that referenced this issue Jan 16, 2024
**Description:**

I made a bad decision while migrating tests in the core repository to snapshot testing. So, I'm adding the `test!` macro back with a slight renaming.

**Related issue:**

 - Closes #8504
@kdy1
Copy link
Member

kdy1 commented Jan 17, 2024

@kdy1 kdy1 modified the milestones: Planned, v1.3.104 Jan 17, 2024
@swc-bot
Copy link
Collaborator

swc-bot commented Feb 16, 2024

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 Feb 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging a pull request may close this issue.

3 participants