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

[Bug]: Set external extension, compilation error during dependent export #8206

Closed
lzxb opened this issue Oct 24, 2024 · 4 comments · Fixed by #8217
Closed

[Bug]: Set external extension, compilation error during dependent export #8206

lzxb opened this issue Oct 24, 2024 · 4 comments · Fixed by #8217
Assignees
Labels
bug Something isn't working

Comments

@lzxb
Copy link
Contributor

lzxb commented Oct 24, 2024

System Info

System:
OS: macOS 15.0.1
CPU: (8) arm64 Apple M1
Memory: 106.00 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.13.1 - ~/.nvm/versions/node/v20.13.1/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.13.1/bin/yarn
npm: 10.5.2 - ~/.nvm/versions/node/v20.13.1/bin/npm
pnpm: 8.15.8 - ~/.nvm/versions/node/v20.13.1/bin/pnpm
bun: 1.1.27 - ~/.bun/bin/bun
Browsers:
Safari: 18.0.1
npmPackages:
@rspack/cli: 1.0.14 => 1.0.14
@rspack/core: 1.0.14 => 1.0.14

Details

Named export is normal, but all exports are incorrect

// Compilation failed
export * from 'test2';
// Compilation successful
export { test2 } from 'test2'

export function test1 () {}

Image

Reproduce link

https://github.com/lzxb/rspack-externals-error

Reproduce Steps

  1. rspack.config.js
{
    externals: ['test2']
}
  1. packages/test1/index.js
export * from 'test2';
  1. Run command
pnpm build
@lzxb lzxb added bug Something isn't working pending triage The issue/PR is currently untouched. labels Oct 24, 2024
@chenjiahan
Copy link
Member

Hi, can you try the modern-module type? It should work:

Image

@fi3ework When will we add documentation for modern-module?

@lzxb
Copy link
Contributor Author

lzxb commented Oct 24, 2024

Image
Image

The exported result is missing

@fi3ework
Copy link
Member

fi3ework commented Oct 24, 2024

Hi, can you try the modern-module type? It should work:

Currently, it does not work with modern-module either. export * is still under track web-infra-dev/rslib#45. I used to try to implement it in modern-module only, but seems it should be fixed as long as output.module = true and module external type used together.

I misread it, only implement in modern-module would be fine.

When will we add documentation for modern-module?

Not in a hurry, many edge cases need to be addressed. We might add it to documentation after Rslib becoming more stable.

@fi3ework
Copy link
Member

I will continue working on preserving export * this week. I found a way to use webpack before, but Rspack is not suitable.

@fi3ework fi3ework self-assigned this Oct 24, 2024
@jerrykingxyz jerrykingxyz removed the pending triage The issue/PR is currently untouched. label Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants