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

Remove 'next/babel' preset #1805

Closed
wants to merge 1 commit into from
Closed

Conversation

mrtnzlml
Copy link
Member

@mrtnzlml mrtnzlml commented Feb 19, 2021

This partially reverts 1c5d0b4

Something changed somewhere somehow. I faced similar issue yesterday with broken class properties plugin and Flow types so I had to do something. This seems to be fixing the issue at least for now.

@mrtnzlml
Copy link
Member Author

cc @tbergq

@mrtnzlml
Copy link
Member Author

And now the scripts/test-bc.js file doesn't work again for whatever reason. 🤦‍♂️

@tbergquist-godaddy
Copy link
Contributor

And now the scripts/test-bc.js file doesn't work again for whatever reason. 🤦‍♂️

Yeah, there is a little gotcha, we are not running this script locally with our yarn test, we should probably add it there.

@tbergquist-godaddy
Copy link
Contributor

Maybe we should have a separate babel-preset for our next-apps, it seems like our preset is not playing nicely with next/babel?

@mrtnzlml
Copy link
Member Author

Yeah, there is a little gotcha, we are not running this script locally with our yarn test, we should probably add it there.

💡 Aha, that's why it's only when running the script directly. I thought it's somehow related to running tests vs. running monorepo-babel-node.

Maybe we should have a separate babel-preset for our next-apps, it seems like our preset is not playing nicely with next/babel?

But why doesn't it play nicely? I don't understand. I am not sure if our preset is the one to blame. 🤔

@tbergquist-godaddy
Copy link
Contributor

Well, it just feels like if the order matters and we have to add additional plugins that are in the preset because we use these 2 presets together, they don't work well together.

I am not sure ours is to blame either. The important part is that we can build or app and run the test scripts 😊

This partially reverts 1c5d0b4

Something changed somewhere somehow. I faced similar issue yesterday with broken class properties plugin and Flow types so I had to do something. This seems to be fixing the issue at least for now.
@mrtnzlml mrtnzlml force-pushed the change_babel_presets_order branch from 00eef51 to 96d440d Compare February 22, 2021 13:46
@vercel vercel bot temporarily deployed to Preview – universe-sx-tailwind-website February 22, 2021 13:46 Inactive
@vercel vercel bot temporarily deployed to Preview – universe-example-relay February 22, 2021 13:46 Inactive
@mrtnzlml mrtnzlml changed the title Change Babel presets order (Next vs. Adeira) Remove 'next/babel' preset Feb 22, 2021
@mrtnzlml
Copy link
Member Author

@tbergq OK, so I'd like to propose a removal of next/babel preset altogether. Please have a look at this updated PR.

@tbergquist-godaddy
Copy link
Contributor

I'll approve it, but it would be nice to double check what it actually adds, and verify that we are not missing some plug-in.

Also, I see that the pipeline is still failing.

@mrtnzlml
Copy link
Member Author

I'll approve it, but it would be nice to double check what it actually adds, and verify that we are not missing some plug-in.

We are definitely missing some Next.js specifics, see: https://github.com/vercel/next.js/blob/4b587d34b867b4f5bad20d520b789f1543249df2/packages/next/build/babel/preset.ts

I don't know how to push it forward though. Having @babel/plugin-proposal-class-properties in plugins is also a bad solution because we have to eventually start using declare fields (before Babel 8) and this made it impossible. 🤔 It starts throwing the following error:

SyntaxError: /Users/martinzlamal/Work/adeira/universe/src/example-relay/src/graphql/locations/types/output/AddLocationOrError.js: TypeScript 'declare' fields must first be transformed by @babel/plugin-transform-typescript.
If you have already enabled that plugin (or '@babel/preset-typescript'), make sure that it runs before any plugin related to additional class features:
 - @babel/plugin-proposal-class-properties
 - @babel/plugin-proposal-private-methods
 - @babel/plugin-proposal-decorators
   8 |
   9 | export class ValidLocationResponse {
> 10 |   declare location: $ReadOnly<{| ...LocationInput, +id: string |}>;
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  11 |   constructor(location: LocationInput) {
  12 |     this.location = {
  13 |       ...location,

Notice the Typescript-specific errors, WTF.

Also, I see that the pipeline is still failing.

I think it's failing because of this which is unrelated: #1825

@mrtnzlml
Copy link
Member Author

I am closing this for now because I am not confident about what's actually going on. 😞

#help_needed 😬

@mrtnzlml
Copy link
Member Author

#1854

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

Successfully merging this pull request may close these issues.

2 participants