Skip to content

Tree shaking missing variable definition? #364

Description

@jamiewinder

It looks like the tree-shaking is not supporting this scenario:

const defaultGreeting = 'Hello';
const defaultName = 'World';

export function greet(opts) {
  const {
    greeting = defaultGreeting,
    name = defaultName
  } = opts;
  console.log(greeting + ' ' + name);
}

Rollup produces:

function greet(opts) {
  const {
    greeting = defaultGreeting,
    name = defaultName
  } = opts;
  console.log(greeting + ' ' + name);
}

Note that defaultGreeting and defaultName are referenced in the code, but not defined anywhere.

Is there a way to disable tree shaking for now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions