Skip to content

Comments

feat: improve MISSING_EXPORT warning to suggest type modifier#6085

Merged
graphite-app[bot] merged 1 commit intomainfrom
09-09-feat_improve_missing_export_warning_to_suggest_type_modifier
Sep 9, 2025
Merged

feat: improve MISSING_EXPORT warning to suggest type modifier#6085
graphite-app[bot] merged 1 commit intomainfrom
09-09-feat_improve_missing_export_warning_to_suggest_type_modifier

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Sep 9, 2025

There are multiple cases that MISSING_EXPORT happens even when TypeScript does not output an error.

  1. chore(rolldown): oxc v0.64.0 #4144 (comment)
    • This case only happens when the importer and the importee is both TS. This is because we treat foo as a "type" rather than a "value" (since we remove export default foo completely. If we treat it as a "value", we should keep that).
  2. The case written in https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax (export { A } from './a')
    • This case only happens when the importer and the importee is both TS. This is because if A is a "value", A would exist after transpilation.

Both of these cases can be fixed by adding the type modifier. While setting verbatimModuleSyntax: true would make TypeScript to error on these cases, it changes some other behaviors, and is not straightforward to turn that on. This PR improves the error message, so that users can know what to do even if they don't enable verbatimModuleSyntax.

refs #4147

Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite: merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify
Copy link

netlify bot commented Sep 9, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 3f55bee
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/68bfbcbe7e966800082fe29e

@sapphi-red sapphi-red marked this pull request as ready for review September 9, 2025 05:00
@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2025

Benchmarks Rust

  • target: main(b42ff21)
  • pr: 09-09-feat_improve_missing_export_warning_to_suggest_type_modifier(3f55bee)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     80.5±1.90ms        ? ?/sec    1.00     80.3±1.80ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     90.5±1.49ms        ? ?/sec    1.00     90.7±1.47ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00    120.1±1.78ms        ? ?/sec    1.01    120.9±1.85ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.01    141.3±2.59ms        ? ?/sec    1.00    140.6±2.70ms        ? ?/sec
bundle/bundle@threejs                                        1.00     45.1±2.93ms        ? ?/sec    1.01     45.5±2.35ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     53.6±1.01ms        ? ?/sec    1.01     54.3±1.10ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    476.0±5.14ms        ? ?/sec    1.00    474.1±6.37ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    557.5±4.82ms        ? ?/sec    1.00    555.6±6.52ms        ? ?/sec
scan/scan@rome_ts                                            1.02     98.1±1.93ms        ? ?/sec    1.00     96.3±1.77ms        ? ?/sec
scan/scan@threejs                                            1.00     34.3±0.46ms        ? ?/sec    1.00     34.3±2.07ms        ? ?/sec
scan/scan@threejs10x                                         1.00    358.3±4.54ms        ? ?/sec    1.00    359.0±4.48ms        ? ?/sec

Copy link
Member

IWANABETHATGUY commented Sep 9, 2025

Merge activity

  • Sep 9, 5:12 AM UTC: The merge label 'graphite: merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 9, 5:12 AM UTC: IWANABETHATGUY added this pull request to the Graphite merge queue.
  • Sep 9, 5:46 AM UTC: The Graphite merge queue couldn't merge this PR because it was not satisfying all requirements (Failed CI: 'node-test (macos-latest) / Node Test').
  • Sep 9, 6:06 AM UTC: The merge label 'graphite: merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Sep 9, 6:06 AM UTC: IWANABETHATGUY added this pull request to the Graphite merge queue.
  • Sep 9, 6:07 AM UTC: Merged by the Graphite merge queue.

)

There are multiple cases that `MISSING_EXPORT` happens even when TypeScript does not output an error.

1. #4144 (comment)
    - This case only happens when the importer and the importee is both TS. This is because we treat `foo` as a "type" rather than a "value" (since we remove `export default foo` completely. If we treat it as a "value", we should keep that).
2. The case written in https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax (`export { A } from './a'`)
    - This case only happens when the importer and the importee is both TS. This is because if `A` is a "value", `A` would exist after transpilation.

Both of these cases can be fixed by adding the `type` modifier. While setting `verbatimModuleSyntax: true` would make TypeScript to error on these cases, it changes some other behaviors, and is not straightforward to turn that on. This PR improves the error message, so that users can know what to do even if they don't enable `verbatimModuleSyntax`.

refs #4147
@graphite-app graphite-app bot force-pushed the 09-09-feat_improve_missing_export_warning_to_suggest_type_modifier branch from b42b84a to 3f55bee Compare September 9, 2025 05:35
@graphite-app graphite-app bot merged commit 3f55bee into main Sep 9, 2025
46 of 47 checks passed
@graphite-app graphite-app bot deleted the 09-09-feat_improve_missing_export_warning_to_suggest_type_modifier branch September 9, 2025 06:07
Boshen added a commit that referenced this pull request Sep 10, 2025
## [1.0.0-beta.37] - 2025-09-10

### 🚀 Features

- partial align with const inline strategy with oxc in smart mode
(#6126) by @IWANABETHATGUY
- dev: use PathsMut for non-debounced RecommendedWatcher (#6120) by
@sapphi-red
- dev: return whether the build is already scheduled from
`scheduleBuildIfStale` method (#6116) by @sapphi-red
- handle errors from `BundlerBuilder#build` (#6104) by @shulaoda
- add debounceTickRate option for debounced watchers (#6113) by @hyf0
- support full build in `incrementalBuild` mode (#6098) by
@IWANABETHATGUY
- add compare_contents_for_polling option to dev watcher (#6108) by
@hyf0
- dev: add `scheduleBuildIfStale` method to DevEngine (#6087) by
@sapphi-red
- dev: return changed files in onHmrUpdates callback (#6086) by
@sapphi-red
- support function config with custom CLI arguments (#6076) by
@IWANABETHATGUY
- improve `MISSING_EXPORT` warning to suggest `type` modifier (#6085) by
@sapphi-red
- crates/rolldown_watcher: introduce `PathsMut` to batch watch/unwatch
behaviors (#6075) by @hyf0
- enable `treeshake.commonjs` by default (#6072) by @IWANABETHATGUY
- dev: add debounce control and PollWatcher support to DevWatchOptions
(#6070) by @hyf0

### 🐛 Bug Fixes

- use kqueue for file watch on mac (#6124) by @sapphi-red
- use patched notify for better file change event debouncing (#6125) by
@sapphi-red
- support passing all js primitive value for `alias` plugin (#6123) by
@IWANABETHATGUY
- track spans in member expression properties for accurate sourcemaps
(#6100) by @IWANABETHATGUY
- correctly handle inlined CommonJS exports in member expressions
(#6090) by @IWANABETHATGUY
- dev: ensure patch file names to be unique (#6096) by @sapphi-red
- dev: normalize slash on Windows before comparing paths (#6095) by
@sapphi-red
- dev/watch: debounce duration should default to 10 (#6078) by @hyf0

### 🚜 Refactor

- simplify `__export` runtime helper to create target object internally
(#6114) by @IWANABETHATGUY
- simplify module_namespace construction second try (#6118) by
@IWANABETHATGUY
- simplify module_namespace construction (#5939) by @IWANABETHATGUY
- optimize member expression creation in AstSnippet (#6091) by
@IWANABETHATGUY
- test-dev-server: sensible watcher configuration for CI env (#6077) by
@hyf0

### 🧪 Testing

- dev: apply HMR edits on Windows (#6094) by @sapphi-red

### ⚙️ Miscellaneous Tasks

- Revert "chore: adjust breaking change template of cliff (#6069)"
(#6130) by @IWANABETHATGUY
- test-dev-server: improve hmr test configuration (#6115) by @hyf0
- deps: update dependency rolldown-plugin-dts to v0.16.2 (#6128) by
@renovate[bot]
- Revert "refactor: simplify module_namespace construction (#5939)"
(#6117) by @IWANABETHATGUY
- test-dev-server: optimize test log output (#6107) by @hyf0
- enable compare_contents_for_polling and update poll interval for CI
test-dev-server (#6110) by @hyf0
- deps: update dependency vite to v7.1.5 [security] (#6111) by
@renovate[bot]
- fix warnings reported by `just lint` (#6105) by @shulaoda
- deps: update dependency tsdown to v0.15.0 (#6102) by @renovate[bot]
- use debug builds for browser tests in CI (#6092) by @hyf0
- test-dev-server: update polling interval and add retry logic for CI
tests (#6088) by @hyf0
- adjust breaking change template of cliff (#6069) by @IWANABETHATGUY

### ◀️ Revert

- "fix: replace_plugin does not work as expected with .ts config
(#5920)" (#6074) by @IWANABETHATGUY

Co-authored-by: Boshen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants