Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use ':' instead of '=' for esbuild 'external' argument #2475

Merged

Conversation

mattsoulanille
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

esbuild passes externals as --external=the_dependency instead of --external:the_dependency as documented.
Issue Number: N/A

What is the new behavior?

Pass externals as --external:the_dependency.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

I named the test directory external-flag since I thought external might be confused with external dependencies.

The test uses fs as the external dependency and runs a Jasmine test to check if console.log(fs) appears in the bundle. This isn't strictly necessary since the bundle will fail to build if fs is not available, but I thought it would be best to have a test target in the PR. It might be more correct to check for var fs = __toModule(require("fs"));, but I think that may change depending on esbuild's implementation. Maybe it's safe to check for require("fs"). What do you think?

Copy link
Collaborator

@mattem mattem left a comment

Choose a reason for hiding this comment

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

Thanks!
There are some golden file tests in there already that would fail if the implementation within esbuild changed, which I had the same thought about regarding correctness, however as the version of esbuild is pinned in the tests here, and if it was bumped we'd have to manually verify the changes to the golden file, I deemed it okay.

In this case, like you say the bundle would fail if external wasn't set, so I think this test is fine, we can expand it later as needed.

@mattem mattem merged commit bc7dc82 into bazel-contrib:stable Feb 18, 2021
@mattsoulanille mattsoulanille deleted the fix_esbuild_external_flag branch February 19, 2021 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants