Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shaker deletes referenced export #94

Open
yepitschunked opened this issue Jul 23, 2024 · 1 comment
Open

Shaker deletes referenced export #94

yepitschunked opened this issue Jul 23, 2024 · 1 comment
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: webpack 📦 Issue is related to webpack bundler cat: monorepo 🔱 Issues related to usage of wyw-in-js in monorepo needs: complete repro 🖥️ Issue need to have complete repro provided

Comments

@yepitschunked
Copy link

yepitschunked commented Jul 23, 2024

Environment

  • wyw-in-js version: 0.5.4
  • custom processor: N/A
  • Bundler (+ version): webpack 5.93.0
  • Node.js version: 20.9.0
  • OS: codesandbox

Description

See the attached codesandbox link for code layout.

index.js imports Spring from dep.js. Shaker deletes the fallback export in dep.js even though it's referenced by Spring:

  wyw-in-js:transform:00001#1->00002#1 create EvaluatedEntrypoint for [ 'Spring' ] +115ms
  wyw-in-js:cache:entrypoints 00002:add /project/workspace/src/dep.js "updated" +1ms
  wyw-in-js:transform:00001#1->00002#1:module evaluate +1ms
  wyw-in-js:transform:00001#1->00002#1:module:source "use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Spring = void 0;
exports.spring = spring;
function spring() {
  return "spring";
}
const Spring = exports.Spring = {
  fallback,
  create: spring
}; +0ms

This results in a ReferenceError when evaluating the module since fallback is an undeclared variable.

The problem goes away if I either:

  • stop exporting fallback
  • rename the parameter in fallback to something else
  • remove the parameter in fallback

Reproducible Demo

https://codesandbox.io/p/devbox/87ryf9

Run DEBUG='wyw-in-js:*' node_modules/.bin/webpack in the terminal.

@yepitschunked yepitschunked added bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided needs: triage 🏷 Issue needs to be checked and prioritized labels Jul 23, 2024
@github-actions github-actions bot added bundler: webpack 📦 Issue is related to webpack bundler cat: monorepo 🔱 Issues related to usage of wyw-in-js in monorepo and removed needs: triage 🏷 Issue needs to be checked and prioritized labels Jul 23, 2024
@yepitschunked
Copy link
Author

@layershifter is this project still alive?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: webpack 📦 Issue is related to webpack bundler cat: monorepo 🔱 Issues related to usage of wyw-in-js in monorepo needs: complete repro 🖥️ Issue need to have complete repro provided
Projects
None yet
Development

No branches or pull requests

1 participant