Skip to content

refactor: remove EXPORT_UNDEFINED_VARIABLE error#8228

Merged
graphite-app[bot] merged 1 commit intomainfrom
copilot/remove-export-undefined-variable-error
Feb 9, 2026
Merged

refactor: remove EXPORT_UNDEFINED_VARIABLE error#8228
graphite-app[bot] merged 1 commit intomainfrom
copilot/remove-export-undefined-variable-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 7, 2026

Oxc's semantic analysis now detects and reports undefined exports as PARSE_ERROR, making Rolldown's custom EXPORT_UNDEFINED_VARIABLE error redundant.

Changes

  • Removed ExportUndefinedVariableError variant from EventKind enum
  • Deleted export_undefined_variable.rs event implementation
  • Removed error constructor from BuildDiagnostic
  • Updated ast_scanner/mod.rs to skip adding exports for undefined bindings (Oxc reports the error)
  • Regenerated event_kind_switcher.rs via code generator

Verification

The existing test export_undefined_variable now receives the error from Oxc:

[PARSE_ERROR] Error: Export 'bar' is not defined
   ╭─[ main.js:4:3 ]
   │
 4 │   bar
   │   ─┬─  

Previously, Rolldown detected this after parsing; now Oxc catches it during semantic analysis.

Original prompt

Remove EXPORT_UNDEFINED_VARIABLE error as it is covered by Oxc semntic


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@netlify
Copy link

netlify bot commented Feb 7, 2026

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 5790e65
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/69897234b3227b0008184250

Copilot AI changed the title [WIP] Remove EXPORT_UNDEFINED_VARIABLE error due to Oxc semantic coverage Remove EXPORT_UNDEFINED_VARIABLE error (covered by Oxc semantic) Feb 7, 2026
Copilot AI requested a review from sapphi-red February 7, 2026 10:24
@sapphi-red sapphi-red changed the title Remove EXPORT_UNDEFINED_VARIABLE error (covered by Oxc semantic) refactor: remove EXPORT_UNDEFINED_VARIABLE error Feb 7, 2026
@sapphi-red sapphi-red marked this pull request as ready for review February 7, 2026 10:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes Rolldown’s custom EXPORT_UNDEFINED_VARIABLE diagnostic now that Oxc semantic analysis reports undefined exports as PARSE_ERROR, eliminating duplicated error handling in Rolldown.

Changes:

  • Removed ExportUndefinedVariableError from EventKind and the generated EventKindSwitcher.
  • Deleted the export_undefined_variable diagnostic event and its BuildDiagnostic constructor.
  • Updated AstScanner to stop emitting a custom diagnostic for export { foo } when foo is not a local binding (letting Oxc surface the error instead).

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/rolldown_error/src/types/event_kind.rs Drops the ExportUndefinedVariableError event kind and its string mapping.
crates/rolldown_error/src/generated/event_kind_switcher.rs Regenerates bitflags to remove the deleted event kind flag.
crates/rolldown_error/src/build_diagnostic/events/mod.rs Removes the module export for the deleted diagnostic event implementation.
crates/rolldown_error/src/build_diagnostic/events/export_undefined_variable.rs Deletes the dedicated diagnostic event implementation.
crates/rolldown_error/src/build_diagnostic/constructors.rs Removes the BuildDiagnostic::export_undefined_variable constructor and import.
crates/rolldown/src/ast_scanner/mod.rs Stops pushing the custom undefined-export diagnostic when a local binding can’t be found.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

Benchmarks Rust

  • target: main(c263b88)
  • pr: copilot/remove-export-undefined-variable-error(9873507)
group                                                        pr                                     target
-----                                                        --                                     ------
bundle/bundle@multi-duplicated-top-level-symbol              1.00     68.2±2.29ms        ? ?/sec    1.02     69.5±1.42ms        ? ?/sec
bundle/bundle@multi-duplicated-top-level-symbol-sourcemap    1.00     73.6±1.14ms        ? ?/sec    1.03     75.6±2.08ms        ? ?/sec
bundle/bundle@rome_ts                                        1.00     98.6±1.33ms        ? ?/sec    1.02    100.5±1.57ms        ? ?/sec
bundle/bundle@rome_ts-sourcemap                              1.00    109.8±1.40ms        ? ?/sec    1.02    112.4±1.92ms        ? ?/sec
bundle/bundle@threejs                                        1.00     34.6±0.96ms        ? ?/sec    1.03     35.6±2.19ms        ? ?/sec
bundle/bundle@threejs-sourcemap                              1.00     39.5±0.97ms        ? ?/sec    1.02     40.4±0.63ms        ? ?/sec
bundle/bundle@threejs10x                                     1.00    356.9±2.57ms        ? ?/sec    1.03    366.3±6.56ms        ? ?/sec
bundle/bundle@threejs10x-sourcemap                           1.00    416.9±5.92ms        ? ?/sec    1.01    421.9±3.71ms        ? ?/sec
scan/scan@rome_ts                                            1.00     79.1±1.53ms        ? ?/sec    1.02     80.5±1.63ms        ? ?/sec
scan/scan@threejs                                            1.00     27.9±1.58ms        ? ?/sec    1.00     28.0±1.34ms        ? ?/sec
scan/scan@threejs10x                                         1.00    282.7±5.42ms        ? ?/sec    1.01    286.1±3.17ms        ? ?/sec

Copy link
Member

sapphi-red commented Feb 9, 2026

Merge activity

  • Feb 9, 5:35 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Feb 9, 5:35 AM UTC: sapphi-red added this pull request to the Graphite merge queue.
  • Feb 9, 5:48 AM UTC: Merged by the Graphite merge queue.

Oxc's semantic analysis now detects and reports undefined exports as `PARSE_ERROR`, making Rolldown's custom `EXPORT_UNDEFINED_VARIABLE` error redundant.

## Changes

- Removed `ExportUndefinedVariableError` variant from `EventKind` enum
- Deleted `export_undefined_variable.rs` event implementation
- Removed error constructor from `BuildDiagnostic`
- Updated `ast_scanner/mod.rs` to skip adding exports for undefined bindings (Oxc reports the error)
- Regenerated `event_kind_switcher.rs` via code generator

## Verification

The existing test `export_undefined_variable` now receives the error from Oxc:

```
[PARSE_ERROR] Error: Export 'bar' is not defined
   ╭─[ main.js:4:3 ]
   │
 4 │   bar
   │   ─┬─
```

Previously, Rolldown detected this after parsing; now Oxc catches it during semantic analysis.

<!-- START COPILOT CODING AGENT SUFFIX -->

<!-- START COPILOT ORIGINAL PROMPT -->

<details>

<summary>Original prompt</summary>

> Remove `EXPORT_UNDEFINED_VARIABLE` error as it is covered by Oxc semntic

</details>

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
@graphite-app graphite-app bot force-pushed the copilot/remove-export-undefined-variable-error branch from 75314d2 to 5790e65 Compare February 9, 2026 05:35
@graphite-app graphite-app bot merged commit 5790e65 into main Feb 9, 2026
34 checks passed
@graphite-app graphite-app bot deleted the copilot/remove-export-undefined-variable-error branch February 9, 2026 05:48
This was referenced Feb 11, 2026
shulaoda added a commit that referenced this pull request Feb 11, 2026
## [1.0.0-rc.4] - 2026-02-11

💡 Granular `comments` Option
- New `output.comments` option provides fine-grained control over comment preservation
- The `output.legalComments` option is now deprecated and use `comments.legal` instead

### 🚀 Features

- rename error name to `RolldownError` from `RollupError` (#8262) by @sapphi-red
- add hidden `resolve_tsconfig` function for Vite (#8257) by @sapphi-red
- rust: introduce `rolldown_watcher` (#8161) by @hyf0
- unify `comments` and `legalComments` into a single granular `comments` option (#8229) by @IWANABETHATGUY
- add builtin plugin for visualizing chunk graph (#8162) by @IWANABETHATGUY
- show import declaration location in AssignToImport errors (#8222) by @Copilot
- show import declaration span in CannotCallNamespace error (#8223) by @Copilot
- emit error when plugin accidentally removes runtime module symbols (#8203) by @IWANABETHATGUY
- support tsconfig loading & inputMap for `transform` (#8180) by @sapphi-red
- rolldown_plugin_vite_reporter: update warning message to link to Rolldown docs (#8205) by @sapphi-red

### 🐛 Bug Fixes

- avoid panic on untranspiled JSX syntax by reporting a diagnostic error (#8226) by @IWANABETHATGUY
- rolldown_plugin_vite_import_glob: relax absolute path check and improve invalid glob warning (#8219) by @shulaoda
- merge chunks after detect circular reference (#8154) by @IWANABETHATGUY
- rust: detect runtime module side effects based on its content (#8209) by @hyf0

### 🚜 Refactor

- rename `other` to `jsdoc` in comments options (#8256) by @IWANABETHATGUY
- rename chunk-visualize plugin with bundle-analyzer plugin (#8255) by @IWANABETHATGUY
- remove EXPORT_UNDEFINED_VARIABLE error (#8228) by @Copilot
- consolidate missing runtime symbol errors into a single diagnostic (#8220) by @IWANABETHATGUY
- stabilize `parse` and `parseSync` (#8215) by @sapphi-red
- return errors instead of panicking on builtin plugin conversion failure (#8217) by @shulaoda
- expose `parse` / `minify` / `transform` from `rolldown/utils` (#8214) by @sapphi-red
- prepare defer chunk merging (#8153) by @IWANABETHATGUY

### 📚 Documentation

- remove `<script>` escape behavior difference note from `platform` option (#8253) by @sapphi-red
- TypeScript & JSX support by plugins (#8183) by @sapphi-red

### 🧪 Testing

- ensure runtime module is preserved even if it's not used but has side effects (#8213) by @hyf0

### ⚙️ Miscellaneous Tasks

- deps: update oxc to v0.113.0 (#8267) by @renovate[bot]
- deps: update dependency oxlint-tsgolint to v0.12.0 (#8272) by @renovate[bot]
- deps: update oxc apps (#8269) by @renovate[bot]
- deps: update test262 submodule for tests (#8261) by @sapphi-red
- deps: update crate-ci/typos action to v1.43.4 (#8260) by @renovate[bot]
- deps: update dependency esbuild to v0.27.3 (#8250) by @renovate[bot]
- deps: update rust crates (#8244) by @renovate[bot]
- deps: update dependency semver to v7.7.4 (#8247) by @renovate[bot]
- deps: update github-actions (#8243) by @renovate[bot]
- deps: update npm packages (#8245) by @renovate[bot]
- deps: update oxc resolver to v11.17.1 (#8240) by @renovate[bot]
- deps: update rust crate oxc_sourcemap to v6.0.2 (#8241) by @renovate[bot]
- rust: handle ignored `RUSTSEC-2025-0141` cargo check error (#8235) by @hyf0
- deps: update dependency oxlint-tsgolint to v0.11.5 (#8233) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to ^0.22.0 (#8232) by @renovate[bot]
- deps: update crate-ci/typos action to v1.43.3 (#8225) by @renovate[bot]
- deps: update dependency rolldown-plugin-dts to v0.21.9 (#8224) by @renovate[bot]
- deps: update crate-ci/typos action to v1.43.2 (#8212) by @renovate[bot]
- remove rolldown_plugin_vite_wasm_helper (#8207) by @shulaoda
- build docs for production (#8206) by @sapphi-red

Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>
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.

4 participants