Coder Social home page Coder Social logo

Migrating to nextjs about arielsvn.github.io HOT 14 OPEN

arielsvn avatar arielsvn commented on July 18, 2024
Migrating to nextjs

from arielsvn.github.io.

Comments (14)

arielsvn avatar arielsvn commented on July 18, 2024 1

Interesting details:

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

TODO

Nice to have

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Deploying to Lambda@Edge https://github.com/danielcondemarin/serverless-next.js/tree/master/packages/serverless-nextjs-component

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

One of my biggest concerns was the number of URLs that google has discovered but not indexed from our sitemap:

image

Out of the 60,585 that we have there, 37k are being excluded from search results, more than 50%. This is not good, especially because I want to add another million urls with sample pages. That would be the real long tail 🔥

Even with all that, we are getting some traffic from Google which is also our #1 traffic source.

image

Other advantages

Pain Points

  • Routing. It doesn't support state

  • Limited control of code splitting?

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Redux

Using Redux is tricky, I would have loved to remove it by this point but we have a bunch of code that depends on it. Mainly for our search page and storing the current state of the user's datasets.

From the examples, there seem to be two approaches to include it. Both create higher order components, in one there's a <Provider and a store for each page and the other one creates a single store for the entire App.

One disadvantage of the latter approach is that it disables automatic static optimization for nextjs.

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

History/router

We were using react-router initially on the client side. Next.js has plans to support it, but it's not a priority.


Notes

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Additional SEO considerations

  • Filters in search should be links
  • Page items in search should be links

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

CSS Styles

  • CRA puts all styles in a single stylesheet while Next.js splits them.

Can global styles only be imported on _app https://nextjs.org/blog/next-9-2#built-in-css-support-for-global-stylesheets RFC: vercel/next.js#8626

Nextjs doesn't work with CSS files in node_modules vercel/next-plugins#70

Started to get this warnings: webpack-contrib/mini-css-extract-plugin#250
facebook/create-react-app#5372 (comment)

They recommend CSS in JS https://nextjs.org/learn/basics/styling-components

Consequently, there are a bunch of practical issues to consider with traditional CSS-file-based styling (especially with SSR), so we suggest avoiding this method when styling for Next.js.
Instead we recommend CSS in JS, which you can use to style individual components rather than importing CSS files.

chunk styles [mini-css-extract-plugin]
Conflicting order between:
 * css ./node_modules/css-loader??ref--6-2!./node_modules/sass-loader/lib/loader.js??ref--6-3!./src/components/Footer/Footer.scss
 * css ./node_modules/css-loader??ref--6-2!./node_modules/sass-loader/lib/loader.js??ref--6-3!./src/components/Button/Button.scss

Also, pages were not rendering correctly when navigating on the client-side:

image

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Packages to remove

  • react-helmet
  • react-scripts

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Sitemap sample

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>https://www.refine.bio/sitemap-0.xml</loc>
    </sitemap>
    <sitemap>
        <loc>https://www.refine.bio/sitemap-1.xml</loc>
    </sitemap>
</sitemapindex>
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" 
    xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" 
    xmlns:xhtml="http://www.w3.org/1999/xhtml" 
    xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" 
    xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" 
    xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
    <url>
        <loc>https://www.refine.bio/</loc>
        <priority>0.5</priority>
    </url>
    <url>
        <loc>https://www.refine.bio/about</loc>
        <priority>0.5</priority>
    </url>
    <url>
        <loc>https://www.refine.bio/experiments/SRP068364/transcriptional-profiling-through-rna-seq-of-zebrafish-larval-liver-after-exposure-to-biliatresone-a-biliary-toxin</loc>
        <priority>0.8</priority>
    </url>
    <url>
        <loc>https://www.refine.bio/experiments/GSE24528/expression-analysis-of-zebrafish-melanoma-and-skin-from-the-mitf-brafv600e-p53-line</loc>
        <priority>0.8</priority>
    </url>
    <url>
        <loc>https://www.refine.bio/experiments/SRP069839/marker-gene-pathway-discovery-for-polystyrene-particle-toxicity-in-zebrafish-larvae</loc>
        <priority>0.8</priority>
    </url>
</urlset>

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Tests

Had some issues mocking fetch

Bigger problems with the integration tests. I need to find a way to https://spectrum.chat/next-js/general/end-to-end-integration-test~74921ed4-2632-410f-93c1-8e3e6407dc1b

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Optimizing build

Chunking strategy changed with vercel/next.js#7631
Announcement here https://nextjs.org/blog/next-9-2#improved-code-splitting-strategy

By default with Nextjs vs with custom config

image

with custom config

image

cost of javscript suggest splitting large bundles https://v8.dev/blog/cost-of-javascript-2019

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Page speed scores before

Landing page

image
image

Search page

https://www.refine.bio/search?q=Medulloblastoma
image
image

Experiments page

https://www.refine.bio/experiments/GSE116436/drug-induced-change-in-gene-expression-across-nci-60-cell-lines-after-exposure-to-15-anticancer-agents-for-2-6-and-24h
image
image

from arielsvn.github.io.

arielsvn avatar arielsvn commented on July 18, 2024

Google coverage after deploy

image

from arielsvn.github.io.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.