Skip to content

The package is not tree-shakeable due to side-effects #254

@0x009922

Description

@0x009922

Description

body-scroll-lock package has side-effects, thus it cannot be fully tree-shaken.

Reproduction

You can explore tree-shaking sample at rollup repl.

Expected

Expected to see in the output only my console.log

Actual

// http-url:https://unpkg.com/body-scroll-lock@latest/lib/bodyScrollLock.esm.js
var hasPassiveEvents = false;
if (typeof window !== "undefined") {
  passiveTestOptions = {
    get passive() {
      hasPassiveEvents = true;
      return void 0;
    }
  };
  window.addEventListener("testPassive", null, passiveTestOptions);
  window.removeEventListener("testPassive", null, passiveTestOptions);
}
var passiveTestOptions;
var isIosDevice = typeof window !== "undefined" && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === "MacIntel" && window.navigator.maxTouchPoints > 1);

// /input.tsx
console.log("my side effects");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions