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

Issues with typescript and export default as #111

Closed
jwaldrip opened this issue Jun 9, 2020 · 4 comments
Closed

Issues with typescript and export default as #111

jwaldrip opened this issue Jun 9, 2020 · 4 comments

Comments

@jwaldrip
Copy link

jwaldrip commented Jun 9, 2020

I am having issues with exports when the plugin is enabled. No issue when the plugin is disabled.

TypeError
Cannot read property 'default' of undefined
Call Stack
 Object.get [as InputSubtext]
  libraries/katana/input/styled-text-input/index.ts:1:403
 Object.get [as InputSubtext]
  libraries/katana/input/index.ts:1:3405
 Object.registerExportsForReactRefresh
  node_modules/@pmmmwh/react-refresh-webpack-plugin/src/runtime/refreshUtils.js:190:38
 Object.eval
  libraries/katana/input/index.ts:3:25
 eval
  libraries/katana/input/index.ts:6:30
 Object.../../../libraries/katana/input/index.ts
  bundle.js:2098:1
 __webpack_require__
  bundle.js:40:31
 Object.eval
  libraries/katana/input/predictive-input.tsx:1:2196
 eval
  libraries/katana/input/predictive-input.tsx:6:30
 Object.../../../libraries/katana/input/predictive-input.tsx
  bundle.js:2153:1
@pmmmwh
Copy link
Owner

pmmmwh commented Jun 10, 2020

Is it possible to provide a reproducible example?

Edit: Specifically, I've tried adding a proxy file in the typescript-without-babel example but was unable to reproduce.

Proxy.ts

export { default as FunctionDefault } from './FunctionDefault';

App.tsx then imports from Proxy.ts instead of FunctionDefault.tsx.

@zxc0328
Copy link

zxc0328 commented Jul 8, 2020

I also encounter with this error and the reason is I named the default export as module, like:

import module from "./src/foo"

and module is a global variable when hot module reload is enabled. So the user-defined module variable conflict with the global one. I'm not sure this behavior is expected or not.

@pmmmwh
Copy link
Owner

pmmmwh commented Jul 8, 2020

I also encounter with this error and the reason is I named the default export as module, like:

import module from "./src/foo"

and module is a global variable when hot module reload is enabled. So the user-defined module variable conflict with the global one. I'm not sure this behavior is expected or not.

This is unrelated to this issue. What do you mean my naming an import module

Can you open a new issue and provide the steps to reproduce please?

@pmmmwh
Copy link
Owner

pmmmwh commented Dec 31, 2020

Closing this - unable to reproduce and inactive.

Feel free to re-open if there is more to share about this.

@pmmmwh pmmmwh closed this as completed Dec 31, 2020
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

No branches or pull requests

3 participants