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(optimizer): case sensitivity collisions in imports (#2861) #3104

Closed
wants to merge 2 commits into from

Conversation

ygj6
Copy link
Member

@ygj6 ygj6 commented Apr 23, 2021

Description

This problem is consistent with the following esbuild command :
esbuild react React --bundle --outdir=out
And the result output is:

$ esbuild react React --bundle --outdir=out
 > error: Duplicate entry point "node_modules/React/index.js"

 > node_modules/react/index.js:3:4: warning: Define "process.env.NODE_ENV" when bundling for the browser
    3 │ if (process.env.NODE_ENV === 'production') {
      ╵     ~~~~~~~~~~~~~~~~~~~~

 > node_modules/react/cjs/react.development.js:12:4: warning: Define "process.env.NODE_ENV" when bundling for the browser
    12 │ if (process.env.NODE_ENV !== "production") {
       ╵     ~~~~~~~~~~~~~~~~~~~~

2 warnings and 1 error
error Command failed with exit code 1.

My current solution is to use id.toLowerCase() to avoid duplication of imports.

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@ygj6 ygj6 changed the title Fix issue 2861 fix(optimizer): case sensitivity collisions in imports (#2861) Apr 23, 2021
@patak-dev
Copy link
Member

Check out this comment from @sodatea here. I don't think we should auto-fix this, there should be a warning as an enhancement, but users should use the correct casing in their imports. Another option is to do this through a rollup plugin equivalent to webpack one mentioned in that issue.

@ygj6
Copy link
Member Author

ygj6 commented Apr 23, 2021

Check out this comment from @sodatea here. I don't think we should auto-fix this, there should be a warning as an enhancement, but users should use the correct casing in their imports. Another option is to do this through a rollup plugin equivalent to webpack one mentioned in that issue.

Thank you for your reply! I will try to improve the warning message.

@ygj6
Copy link
Member Author

ygj6 commented Apr 26, 2021

The warning message is generated by esbuild, So if we want to improve it, we may need to change the esbuild code.

@patak-dev
Copy link
Member

There is a new formatMessages API in esbuild 0.10.1 (context). This may be an option in the future.

@Shinigami92
Copy link
Member

Shinigami92 commented Aug 1, 2021

image

Uhm... what?! How old is this PR 👀
I NEEDS a rebase 😄


But reading the comments up there between you two...
Should this PR just be closed?

@ygj6
Copy link
Member Author

ygj6 commented Aug 2, 2021

image

Uhm... what?! How old is this PR 👀
I NEEDS a rebase 😄

But reading the comments up there between you two...
Should this PR just be closed?

Yes, I think this PR can be closed.

@Shinigami92 Shinigami92 closed this Aug 2, 2021
@Shinigami92 Shinigami92 added wontfix This will not be worked on invalid This doesn't seem right and removed needs rebase wontfix This will not be worked on labels Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants