Skip to content

Instantly share code, notes, and snippets.

@Jno21
Created September 9, 2020 12:01
Show Gist options
  • Save Jno21/0c641cd2e009b2f994823598b77e0366 to your computer and use it in GitHub Desktop.
Save Jno21/0c641cd2e009b2f994823598b77e0366 to your computer and use it in GitHub Desktop.
Install gatsby plugin intl

Gatsby-plugin-intl special version

Pre-requisite

Make sure the gatsby-plugin-intl is not present in node_modules and package.json. If needed uninstall it: npm uninstall gatsby-plugin-intl

Installation

Install the plugin

To use my version of the plugin:

  • Go inside your gatbsy repository (root directory)
  • Create a folder called plugins: mkdir plugins
  • Add plugins to your .gitignore
  • Clone this repository inside plugins:
cd plugins
git clone git@github.com:Jno21/gatsby-plugin-intl.git
cd gatsby-plugin-intl
git checkout generated-content

Add it to gatsby

In gatsby-config.js add or replace your gatsby-plugin-intl config by the following:

{
  resolve: require.resolve(`./plugins/gatsby-plugin-intl`),
  options: {
    // Your usual options
  },
},

The important thing is the resolve part ! You can configure the rest of the options as you want.

Now in the root folder of your project use this command: npm link ./plugins/gatsby-plugin-intl

The plugin is now installed and work.

PS: if you add a new module doing an npm install you might need to do rm -r ./plugins/gatsby-plugin-intl/node_modules and npm link ./plugins/gatsby-plugin-intl

@adiusz
Copy link

adiusz commented Sep 26, 2020

Hey @Jno21, good job, appreciate it.
But since we are ignoring this /plugins folder site cannot be deployed to Netlify, which is kind of big flaw since it won't work on any other CDN too (I guess).
To be honest I don't really understand this installation process, but wouldn't it be easier to just fork primary repo of gatsby-plugin-intl and make a new one which could be added to plugins?
It would be shame if your work won't be accessible to all people easily ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment