[Bug]: Can't resolve self-referencing
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 32/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, typescript
- Domain
- build-system
Research direction
Start by reproducing the failure with the files shown in index.js, a.js, and b.js and the webpack command using rspack.config.mjs. Trace how the self-reference import is resolved when the package exports target cannot be resolved. Done means the package can resolve its own import in this source scenario without the reported module-not-found error.
Written by the indexing model from the issue text.
Description
Version
/
Details
Given a package named @monorepo/self for example. If trying to bare import package itself. webpack / Rspack can't resolve the package. It works in webpack / Rspack with exports field when exports target could be resolved. But when not, for example the source is TS, it will failed to resolve.
// index.js
import { a } from './a.js'
import { b } from './b.js'
export { a, b }
// a.js
export const a = 1
// b.js
import { a } from '@monorepo/self'
export const b = 1 + a
error message:
> @monorepo/self@ build:webpack /Users/bytedance/Projects/webpack-test-out-library-esm-output/packages/self-import
> webpack --config rspack.config.mjs
asset main.mjs 2.07 KiB [compared for emit] [javascript module] (name: main)
runtime modules 670 bytes 3 modules
orphan modules 78 bytes [orphan] 2 modules
./src/index.mjs + 2 modules 141 bytes [built] [code generated]
ERROR in ./src/b.js 1:0-34
Module not found: Error: Can't resolve '@monorepo/self' in '/Users/bytedance/Projects/webpack-test-out-library-esm-output/packages/self-import/src'
@ ./src/index.mjs 2:0-22 4:0-15
ERROR in ./src/index.mjs 4:0-15
export 'default' (reexported as 'a') was not found in './a.js' (possible exports: a)
ERROR in ./src/index.mjs 4:0-15
export 'default' (reexported as 'b') was not found in './b.js' (possible exports: b)
1 error has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
webpack 5.93.0 compiled with 3 errors in 48 ms
ELIFECYCLE Command failed with exit code 1.
Reproduce link
/
Reproduce Steps
/
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 67
- Avg merge
- 6h 9m
- Merged PRs (30d)
- 57
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from web-infra-dev/rslib
-
Rspack
Difficulty 4/5 3-5 days Newbie friendliness 45/100
web-infra-dev/rslib#1839 ·
-
Rspack
web-infra-dev/rslib#1825 · 1 reaction · 1 assignee ·
-
Rspack
web-infra-dev/rslib#1519 · 1 assignee ·
-
PR welcome
Difficulty 5/5 Over a week Newbie friendliness 42/100
web-infra-dev/rslib#1291 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
web-infra-dev/rslib#1286 · 3 comments ·
All issues in web-infra-dev/rslib
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
fullcalendar/fullcalendar#8106 ·