aidenybai / million

Optimize React performance and make your React 70% faster in minutes, not months.
https://million.dev
MIT License
16.26k stars 574 forks source link

Add compatibility with Gatsby, Remix, etc. #322

Closed joebentaylor1995 closed 1 year ago

joebentaylor1995 commented 1 year ago

As the title suggested, can this be used in a Gatsby project?

aidenybai commented 1 year ago

technically yeah. just use the webpack plugin inside your gatsby plugin instead https://millionjs.org/docs/compiler but pass in: million.webpack({ mode: 'next' })

tobySolutions commented 1 year ago

Can we close this issue now @aidenybai?

tobySolutions commented 1 year ago

We have support for Gatsby now @aidenybai. Not sure about Remix yet @joebentaylor1995.

aidenybai commented 1 year ago

We can't get Remix support because they don't have a plugin system

SukkaW commented 1 year ago

@aidenybai @tobySolutions I believe we can close this issue now since Million already provides plugins for Webpack and Next.js, while Gatsby users can use Million's Webpack plugin.

As for Remix, IIRC Remix uses the esbuild under the hood. And according to the Remix Team (https://github.com/remix-run/remix/issues/717) and here I quote:

... we do not plan on opening up our compiler. Our usage of esbuild is an implementation detail.

That's to say, Remix will most likely never provide an option to manipulate its compiler behavior/configuration, which also means it is impossible for anyone to create a third-party plugin to change Remix's compiler option in any foreseeable future.

joebentaylor1995 commented 1 year ago

Is there any documentation on how to enable this in gatsby? I feel clueless setting this up

tobySolutions commented 1 year ago

Is there any documentation on how to enable this in gatsby? I feel clueless setting this up

Sure, in the docs. We show you how you can add the compiler to make sure that you can enable it in Gatsby.

To use it though, you can test the block() on the components in your application.

Let me know if you have any other issues. Also, let me know if the documentation doesn't work.

joebentaylor1995 commented 1 year ago

Could you link me to this? I can’t seem to find thisOn 24 May 2023, at 02:15, Tobiloba Adedeji @.***> wrote:

Is there any documentation on how to enable this in gatsby? I feel clueless setting this up

Sure, in the docs. We show you how you can add the compiler to make sure that you can enable it in Gatsby. To use it though, you can test the block() on the components in your application. Let me know if you have any other issues. Also, let me know if the documentation doesn't work.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

aidenybai commented 1 year ago

@joebentaylor1995

https://million.dev/docs/install#use-the-compiler

const million = require('million/compiler');

exports.onCreateWebpackConfig = ({ actions }) => {
  actions.setWebpackConfig({
    plugins: [million.webpack({ mode: 'react-server' })],
  })
}