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

Parcel is not liking importing named and exported functions sharing the same name #7094

Closed
jamesmcallister opened this issue Oct 15, 2021 · 2 comments · Fixed by #7102
Closed

Comments

@jamesmcallister
Copy link

🐛 bug report

Parcel is not liking importing named and exported functions.

Screenshot 2021-10-15 at 13 50 43

🎛 Configuration (.babelrc, package.json, cli command)

babel.rc

{
  "plugins": ["babel-plugin-styled-components"]
}
{
  "scripts": {
    "start": "parcel index.html",
    "build": "parcel build"
  },
  "devDependencies": {
    "parcel": "^2.0.0"
  },
  "dependencies": {
    "babel-plugin-styled-components": "^1.13.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "styled-components": "^5.3.1"
  }
}

🤔 Expected Behavior

Should be defined

😯 Current Behavior

Worked fine with 2.0.0-nightly.842

💻 Code Sample

https://github.com/jamesmcallister/parcel-bug

🌍 Your Environment

Software Version(s)
Parcel 2.0.0
Node 16.11.1
npm/Yarn 8.0.0/N/A
Operating System
@mischnic
Copy link
Member

Reproduction:

import { Foo } from "./media.item";  // actual value doesn't matter

const S = {
	Foo: () => <div>S</div>,
};

console.log(<S.Foo />);

Output:

console.log(/*#__PURE__*/ _jsxRuntime.jsx(S._mediaItem.Foo, {}));

Looks like we incorrectly traverse into member expressions if they are JSX tag names, and the "Foo" property name is treated as though it was an identifier (so S[Foo])

@ross-pfahler
Copy link

Ran into the same at https://github.com/ross-pfahler/parcel-2-demos/tree/react-context -- common use case is to have a component named "Provider" and have a context provider -- eg MyContext.Provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants