-
-
Notifications
You must be signed in to change notification settings - Fork 781
Description
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(...)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)
