Skip to content

using Gatsby with Nx (Extensible Dev Tools for Mono-repository)

License

Notifications You must be signed in to change notification settings

erkobridee/nx-gatsby

Repository files navigation

NxGatsby

It's no possible to upgrade to the Gatsby v3 right now, because the nx gatsby plugin (code) doesn't support it

[GitHub] nrwl/gatsby - Update to gatsby version 3.0.1 #41

[GitHub] nrwl/nx - Gatsby v3.0.0 Support #4966

Goal

  • check how the Gatsby works with Nx

Documentation

Project dependency graph

nx dep-graph

implicit - means some sort of manual configuration

Findings

  • at the first try it's possible to add the Gatsby site inside of the nx workspace, the only point until now was to add the support to the project it was needed to run the following command:

npm i --save-dev @nrwl/gatsby gatsby-cli

  • to run the gatsby generate site inside of the nx workspace you should use the command:

nx serve <generated-site-name> (on this example it was gatsby)

  • when I tried to run the lint over the e2e tests of the gatsby I notice a wrong configuration on the workspace.json which was set to the apps/gatsby-e2e, where it should use the same lint runner as the apps/gatsby

  • when I runned the lint over the apps/gatsby I get some warning messages, to remove them, I needed to change the lint configuration on the workspace.json to ignore the apps/gatsby/public folder

  • using the Gatsby inside of the Nx workspace it's basically like have 2 react applications, nothing special was notice to be able to use it

  • to map the libs/assets into the gatsby application it was needed some extra manual steps because the gatsby doesn't supports the baseUrl from the tsconfig.base.json

Links

Development tip

  • to make my life easier I have the current node_modules from the project mapped to the PATH env variable, that enables me to run the command nx directly, if you don't have if you must use the short cut mapped on the package.json, using it like npm run nx ... or it's also possible to use like npx nx ... (the npx will look into the local installed packages ./node_modules/ and on the global installed packages)

    • ./node_modules/.bin

Known Gatsby TypeScript support limitation

Known issues on MacOS

About

using Gatsby with Nx (Extensible Dev Tools for Mono-repository)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published