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]: Default export from @rspack/core does not have TypeScript types #8095

Open
mxmason opened this issue Oct 11, 2024 · 0 comments · May be fixed by #8169
Open

[Bug]: Default export from @rspack/core does not have TypeScript types #8095

mxmason opened this issue Oct 11, 2024 · 0 comments · May be fixed by #8169
Assignees
Labels
bug Something isn't working

Comments

@mxmason
Copy link

mxmason commented Oct 11, 2024

System Info

System:
OS: macOS 14.5
CPU: (8) arm64 Apple M2
Memory: 71.22 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v20.11.1/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v20.11.1/bin/npm
pnpm: 8.15.6 - ~/.nvm/versions/node/v20.11.1/bin/pnpm
bun: 1.1.12 - ~/.bun/bin/bun
Browsers:
Chrome: 129.0.6668.91
Safari: 17.5
npmPackages:
@rspack/cli: ^1.0.10 => 1.0.10
@rspack/core: ^1.0.10 => 1.0.10
@rspack/dev-server: ^1.0.8 => 1.0.8

Details

While the following code runs as expected, the types for Compiler#run only show up if one imports rspack as a named import. Note: this is true in both ESM and CommonJS.

const rspack = require('@rspack/core')

const compiler = rspack(config)

compiler.run(...)

Image
Image

Reproduce link

No response

Reproduce Steps

In an rspack project, try the following import scenarios

ESM, has types:

import { rspack } from '@rspack/core'

const configs = require('./path/to/config.js')

const compiler = rspack(configs)

ESM, no types:

import rspack from '@rspack/core'

const configs = require('./path/to/config.js')

const compiler = rspack(configs)

CommonJS, has types:

const { rspack } = require('@rspack/core')

const configs = require('./path/to/config.js')

const compiler = rspack(configs)

CommonJS, no types:

const rspack = require('@rspack/core')

const configs = require('./path/to/config.js')

const compiler = rspack(configs)
@mxmason mxmason added bug Something isn't working pending triage The issue/PR is currently untouched. labels Oct 11, 2024
@LingyuCoder LingyuCoder removed the pending triage The issue/PR is currently untouched. label Oct 17, 2024
@SoonIter SoonIter linked a pull request Oct 18, 2024 that will close this issue
2 tasks
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.

3 participants