This plugin integrates `tsconfig-paths-webpack-plugin` into Gatsby builds, enabling resolution of module aliases defined in `tsconfig.json`. This simplifies imports, especially in large TypeScript projects, by allowing absolute or aliased paths instead of lengthy relative ones. The current stable version is 1.0.6. It doesn't appear to follow a strict time-based release cadence, with updates typically occurring to ensure compatibility with new major versions of Gatsby. For instance, recent updates added support for Gatsby v5. Its key differentiator is its seamless, zero-config integration for most standard Gatsby setups, abstracting away the manual Webpack configuration typically required for `tsconfig-paths-webpack-plugin`. Users can also pass through any `tsconfig-paths-webpack-plugin` options if more granular control is needed.
npm install gatsby-plugin-tsconfig-pathsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to include and configure the plugin in `gatsby-config.js` with common options.
Explicitly set the `extensions` option for `gatsby-plugin-tsconfig-paths` if you have a custom setup or experience resolution issues, e.g., `options: { extensions: ['.ts', '.tsx', '.js', '.jsx', '.mjs'] }`.Always ensure your `gatsby` package version aligns with the `peerDependencies` specified by `gatsby-plugin-tsconfig-paths`. Upgrade `gatsby-plugin-tsconfig-paths` to `v1.0.6` or newer for full Gatsby v5 compatibility.
Verify that your `tsconfig.json` `compilerOptions.paths` are correctly defined and that `gatsby-plugin-tsconfig-paths` is properly included in `gatsby-config.js`. If your `tsconfig.json` is not at the project root, ensure you're using the `configFile` option, e.g., `options: { configFile: './path/to/tsconfig.json' }`.Check the `peerDependencies` listed in `node_modules/gatsby-plugin-tsconfig-paths/package.json` and ensure your project's `gatsby` version falls within the allowed range. Upgrading `gatsby-plugin-tsconfig-paths` to its latest version (currently `1.0.6`) often provides broader `gatsby` version support, including `gatsby@5`.