FFFF Avoid panic on `export` of top-level variable when used in global mode · Issue #9 · wilsonzlin/minify-js · GitHub
[go: up one dir, main page]

Skip to content

Avoid panic on export of top-level variable when used in global mode #9

Open

Description

@wilsonzlin

In global mode, top-level variables are not added to any scope, so a statement like export a or export { a } will panic due to not finding the symbol if accidentally invoked with TopLevelMode::Global instead of TopLevelMode::Module.

Activity

  1. neutralvibes commented on Jun 10, 2023

    @neutralvibes

    This issue still exists.

        let target_symbol = top_level_scope
          .find_symbol(e.target)
          .expect(format!("failed to find top-level export `{:?}`", e.target).as_str());
    

    Unexpecting library users, pun intended 😆, really need errors fed up to them to handle, rather than being dumped out unceremoniously by any 'expect' statement. This lib is a great effort, would be great if this was addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0