solana icon indicating copy to clipboard operation
solana copied to clipboard

[Explorer] NextJS port for Webpack 5 compatibility

Open nixxholas opened this issue 2 years ago • 2 comments

Greetings maintainers! I (and my team) am currently maintaining a small team via the MLH Solana programme (with assistance from our core devs) and we're looking into upgrading the core framework of the explorer (CRA4 - Webpack 4) over to WP5. In order to do so (while carrying much lesser problems in upgrading), would we stand a chance if the framework moves over from CRA4 to NextJS?

We're also running a fork of the explorer atm and are looking to value-add more cross explorer, but since this chance is significant, looking to consult you guys first!

Problem

Referencing https://github.com/facebook/create-react-app/issues/11756, it is unfavourable to continue to build explorer around CRA. With an impending issue bound to cause a downward spiral due to 0 support with default polyfills - as you can see, the issue has been open for a little over 7 months. It is still Open as of now, and we will never be sure about when it will be resolved.

https://github.com/vercel/next.js/pull/16022 - nextJS add support for browser polyfills for node.js modules

Referencing https://github.com/solana-labs/solana/issues/25197, most of solana-labs packages have moved to ESModules which does not have support for CRA4, lots of workaround with the usage of writing config-overrides.js and react-app-rewired to try to get ESModules support on CRA4 (locked on older versions)

Proposed Solution

Instead, we propose migration to NextJS (built in Webpack 5 by default).

Static Generation (SG) can be utilised to preload pages which do not change (blocks, transactions, epochs) at all to improve loading performance for the explorer.

Conclusion

If this is not favourable, we can always focus on the upgrade towards CRA5 instead, but its carrying a lot of issues with some of the external package the explorer already is dependent on (like mango's lib)

Hope you guys can approve this idea and we'll start work!

nixxholas avatar Jun 15 '22 12:06 nixxholas

I think about this almost every day. I would love to see this happen. It's almost certainly a ton of work.

steveluscher avatar Jun 15 '22 16:06 steveluscher

nx has migrated to webpack 5 so I suspect more and more people are going to be impacted by this issue. Are there any plans to pick this up? Can #26032 be continued?

janeklb avatar Jan 24 '23 00:01 janeklb