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

export * from 'xxx' statements are incorrectly omitted by wyw #82

Open
hjkcai opened this issue Apr 30, 2024 · 3 comments
Open

export * from 'xxx' statements are incorrectly omitted by wyw #82

hjkcai opened this issue Apr 30, 2024 · 3 comments
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: webpack 📦 Issue is related to webpack bundler needs: complete repro 🖥️ Issue need to have complete repro provided

Comments

@hjkcai
Copy link

hjkcai commented Apr 30, 2024

Environment

  • wyw-in-js version: 0.5.3
  • custom processor: No
  • Bundler (+ version): Webpack 5.88.2
  • Node.js version: 16.20.2
  • OS: Arch Linux

Description

As the issue title said. I tried to debug the webpack loader. I am sure that wyw's loader has omitted the export * statement.

image

Reproducible Demo

Source Code:

// main.js
import { foo, bar } from './a';
console.log(foo, bar); // cannot find 'foo'

// a.js
export * from './b';
export const bar = 'baz';

// b.jsx
export const foo = 42;

Configuration File (wyw-in-js.config.js):

module.exports = {
  extensions: ['.js'],
};
@hjkcai hjkcai 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 Apr 30, 2024
@github-actions github-actions bot added bundler: webpack 📦 Issue is related to webpack bundler and removed needs: triage 🏷 Issue needs to be checked and prioritized labels Apr 30, 2024
@layershifter
Copy link
Collaborator

Can you please provide a complete example on Stackblitz?

@hjkcai
Copy link
Author

hjkcai commented May 6, 2024

https://stackblitz.com/edit/webpack-5-react-starter-sywkqd

I found the key problem: If b.jsx was ignored from wyw, and a.js has export * from './b', the statement will be removed by wyw in explodeReexports.ts Line 98.

image

In my project, all .ts files are ignored to make compliation faster. Only .tsx files are processed by wyw. Then this issue occurs.

@hjkcai
Copy link
Author

hjkcai commented May 14, 2024

@layershifter Hi! Any thoughts?

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 needs: complete repro 🖥️ Issue need to have complete repro provided
Projects
None yet
Development

No branches or pull requests

2 participants