1. 11 Feb, 2024 2 commits
  2. 10 Feb, 2024 5 commits
  3. 09 Feb, 2024 12 commits
  4. 08 Feb, 2024 19 commits
  5. 07 Feb, 2024 2 commits
    • Jiachi Liu's avatar
      Fix attempted import error for react (#61791) · ed3ee381
      Jiachi Liu authored
      ### What
      
      Exclude precompiled react packages from browser layer loaders coverage.
      
      ### Why
      
      Since we're transpiling all the browser layer code now after #59569,
      then SWC will also compile react. But when it compiles
      `react.production.min.js` it gives me with the code and ESM helper
      inserted
      
      ```js
      import { _ as _type_of } from "@swc/helpers/_/_type_of"; // This is not correct
      var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Sym
      bol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.f
      ```
      
      This makes bundler think it's a ESM package but actually it's CJS, which
      converts the module into `{ default: .., __esModule }` instead of the
      original react module.
      
      When you're using `React.useEffect` or other API through namespace
      import (`import * as React from 'react'`), this will break the module
      exports check in bundling as the property doesn't directly attached to
      the module now. This PR disabled the transform for precompiled react
      packages now and will see the deeper issue in next-swc side later.
      
      Fixes #60890
      Fixes #61185
      
      Closes NEXT-2362
      ed3ee381
    • Balázs Orbán's avatar
      fix(ts): match `MiddlewareConfig` with documentation (#61718) · 53fd5ac0
      Balázs Orbán authored
      ### What?
      
      Fix the user-facing `MiddlewareConfig` interface.
      
      ~While in the codebase, I also made the incoming config object type a
      bit more strict by converting from `any` to `unknown`.~ Reverted, as we
      do a config assertion already in a [different
      place](https://github.com/vercel/next.js/blob/canary/packages/next-swc/crates/next-custom-transforms/src/transforms/page_config.rs/#L171-L180).
      
      ### Why?
      
      The interface we previously exposed was the one we used internally,
      _after_ we did some parsing on the config object, which is different
      from what the user is expected to pass.
      
      ### How?
      
      I separated the internal type to its own `MiddlewareConfigParsed`
      interface.
      
      Closes NEXT-2375
      Fixes #61705
      
      Ref: #61576
      53fd5ac0