Giter Site home page Giter Site logo

Comments (4)

brophdawg11 avatar brophdawg11 commented on June 15, 2024 2

yeah this seems to be a bug in rollup 4.16 when it comes to function parameters with default values.

Our flattenRoutes function is defined as:

function flattenRoutes<
  RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject
>(
  routes: RouteObjectType[],
  branches: RouteBranch<RouteObjectType>[] = [],
  parentsMeta: RouteMeta<RouteObjectType>[] = [],
  parentPath = ""
): RouteBranch<RouteObjectType>[] {
  ...
}

And it gets transpiled down differently in rollup 4.15 versus 4.16, with 4.16 incorrectly blowing away the branches parameter value on every invocation:

// rollup 4.15
function flattenRoutes(routes, branches, parentsMeta, parentPath) {
  if (branches === void 0) {
    branches = [];  // ✅ Only sets the default if no value is passed
  }
  if (parentsMeta === void 0) {
    parentsMeta = [];
  }
  if (parentPath === void 0) {
    parentPath = "";
  }
  // ...
}

// rollup 4.16
function flattenRoutes(routes, branches, parentsMeta, parentPath) {
  {
    branches = []; // ❌ Lost the if statement, so it sets the default every time
  }
  if (parentsMeta === void 0) {
    parentsMeta = [];
  }
  if (parentPath === void 0) {
    parentPath = "";
  }
  // ...
}

from remix.

brophdawg11 avatar brophdawg11 commented on June 15, 2024 2

This should be resolved in rollup 4.16.2: https://github.com/rollup/rollup/releases/tag/v4.16.2

from remix.

huijiewei avatar huijiewei commented on June 15, 2024 1

override rollup to 4.15.0, this is rollup issue.

from remix.

brophdawg11 avatar brophdawg11 commented on June 15, 2024 1

For now the proper workaround is to install [email protected], or set it in the overrides section of your package.json:

"overrides": {
    "rollup": "4.15.0"
}

from remix.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.