swc-project / swc-loader

Moved to https://github.com/swc-project/pkgs
MIT License
394 stars 29 forks source link

Intermittent loader issue: Module build failed . Expected '>', got 'value' #50

Closed passbyval closed 2 years ago

passbyval commented 2 years ago

Over the past week, swc-loader has begun intermittently throwing errors, and failing to build:

webpack:pid=857 Module build failed (from ../../node_modules/swc-loader/src/index.js):
webpack:pid=857 Error: 
webpack:pid=857   x Expected '>', got 'value'
webpack:pid=857     ,-[/app/packages/src/Accordion/index.tsx:80:5]
webpack:pid=857  80 | <AccordionContext.Provider value={contextValue}>
webpack:pid=857     :                            ^^^^^
webpack:pid=857     `----

This happens to all React components.

Loader config:

{
  test: /\.(tsx|mjs|ts)?$/,
  exclude: /(node_modules)/,
  use: [
    {
      loader: "swc-loader",
      options: {
        jsc: {
          parser: {
            syntax: "typescript"
          }
        }
      }
    }
  ]
}

Versions:

{
   "@swc/cli": "^0.1.57",
   "@swc/core": "^1.2.171",
   "@swc/jest": "^0.2.20",
   "swc-loader": "^0.2.0"
}

The weird thing is, one day it will work fine, but the next it starts breaking again with no changes.

Troubleshooting tried:

NearImba commented 2 years ago

"@swc/core": "1.2.179", "swc-loader": "0.1.16", It also happened to me, As workaround, you can revert swc/loader to above version to skip this issue

passbyval commented 2 years ago

Downgrading didn't work for me, but removing the options object from the swc-loader config did:

{
  loader: "swc-loader",
  options: {
    jsc: {
      parser: {
        syntax: "typescript"
      }
    }
  }
}

->

{
  loader: "swc-loader",
}
kdy1 commented 2 years ago

Oh... I'm not sure about the cause

kdy1 commented 2 years ago

Ah, maybe the patch for overriding configs is the cause.