effector / swc-plugin-legacy

SWC plugin to efficiently work with effector
https://npmjs.com/@effector/swc-plugin
27 stars 3 forks source link

[Bug]: plugin breaks decorators compilation #18

Open vvysokiy opened 1 year ago

vvysokiy commented 1 year ago

Description

Example: https://github.com/vvysokiy/swc-jest-decorators

Correct compiled code - playground link

Config .swcrc

{
  "$schema": "https://json.schemastore.org/swcrc",
  "sourceMaps": true,
  "jsc": {
    "target": "es2020",
    "loose": true,
    "externalHelpers": true,
    "keepClassNames": false,
    "parser": {
      "syntax": "typescript",
      "tsx": true,
      "decorators": true,
      "dynamicImport": true
    },
    "transform": {
      "legacyDecorator": true,
      "decoratorMetadata": true,
      "react": {
        "runtime": "automatic"
      }
    },
    "experimental": {
      "plugins": [
        [
          "@effector/swc-plugin",
          {}
        ]
      ]
    },
    "minify": {
      "mangle": false,
      "compress": false
    }
  },
  "minify": false,
  "module": {
    "type": "commonjs",
    "strict": true,
    "strictMode": true,
    "lazy": true,
    "noInterop": false
  }
}

Versions

"@effector/swc-plugin": "0.0.8",
"@effector/swc-plugin": "0.0.7"

Device

Drevoed commented 1 year ago

Thanks for the issue, will look into it 👍

Drevoed commented 1 year ago

Can you try this again with v0.0.9?

@vvysokiy

vvysokiy commented 1 year ago

@Drevoed

 RUNS  tests/test.spec.ts
thread '<unnamed>' panicked at 'position 0 does not resolve to a source location', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9e FAIL  tests/test.spec.tsrc/source_map.rs:1086:17
  ● Test suite failed to run

    failed to handle: position 0 does not resolve to a source location

      at Compiler.transformSync (node_modules/@swc/core/index.js:241:29)

Test Suites: 1 failed, 1 total

Example