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

react library build failed #2496

Closed
4 tasks done
Jimmysh opened this issue Feb 16, 2020 · 8 comments · Fixed by #2524
Closed
4 tasks done

react library build failed #2496

Jimmysh opened this issue Feb 16, 2020 · 8 comments · Fixed by #2524
Assignees
Labels
outdated scope: react Issues related to React support for Nx type: bug

Comments

@Jimmysh
Copy link
Contributor

Jimmysh commented Feb 16, 2020

Prerequisites

  • I am running the latest version
  • I checked the documentation (nx.dev) and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (not related to React, Angular or any dependency)

Expected Behavior

React library can build success.

export async function create() {
  return { a: 1 };
}
export async function test() {
  const { a } = await create();
  console.log(a);
}

Current Behavior

Build failed.
error message
.../test.tsx: Property name expected type of string but got null

change file to this can build success.

export async function create() {
  return { a: 1 };
}
export async function test() {
  const c = await create();
  console.log(c.a);
}

Context

error same as storybookjs/storybook#4615

@jaysoo
Copy link
Member

jaysoo commented Feb 19, 2020

Thanks for the report, we'll look into it.

@rarmatei
Copy link
Collaborator

hey @Jimmysh - thank you so much for reporting this. I'm having some trouble reproducing the error you're seeing. The issue you linked to seems to have been fixed in Storybook 4.1.x (we are using 5.3.9).

I also tried build the project referenced in aiao-io/aiao#52
..but it seems to have been removed https://github.com/aiao-io/aiao/tree/master/integration/stencil-toolkit-nx

Would you be able to share a repo please that showcases this and the command you're running?

@Jimmysh
Copy link
Contributor Author

Jimmysh commented Feb 20, 2020

@rarmatei
repo: https://github.com/Jimmysh/nx-issues-2496

  npx nx build react-lib

@rarmatei
Copy link
Collaborator

rarmatei commented Feb 20, 2020

Thanks for the super quick response! I can definitely reproduce it now in a fresh nx workspace as well:

nx g @nrwl/react:lib test-lib --publishable
//add the await code you mentioned to libs/test-lib/src/index.ts
nx build test-lib

I'll look into it 👍

@rarmatei
Copy link
Collaborator

I think it's related to: babel/babel#10808

Can confirm setting: https://github.com/nrwl/nx/blob/master/packages/web/src/utils/babel-config.ts#L24 to undefined fixes it

@jaysoo what do you think is best? should we wait for updates on that babel issue, or is there anything we can do about that targets config?

@jaysoo
Copy link
Member

jaysoo commented Feb 20, 2020

We might be able to remove targets and the esm2015 format since the only reason we had esm5 vs esm2015 was because it was ported from Angular.

  • ESM5 = ES5 + ESM
  • ESM2015 = ES6/ES2015 + ESM

But we really don't care about ES5 vs ES2015+, what we really need is UMD vs ESM formats. Whether the user wants to compile to ES5, ES2015, ES2020, etc. is up to them and how they customize their babel config.

@Jimmysh
Copy link
Contributor Author

Jimmysh commented Jun 19, 2020

9.4.4 this error come back. https://github.com/Jimmysh/nx-issues-2496 @rarmatei @jaysoo

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: react Issues related to React support for Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants