Package Exports
- gatsby-plugin-preact
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gatsby-plugin-preact) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
gatsby-plugin-preact
Provides drop-in support for replacing React with Preact.
While Preact doesn't provide full support for the React ecosystem, it is an intriguing option for Gatsby sites as it saves ~30kb of JavaScript vs. using React.
Note: This plugin uses Preact X, any version prior to
v10.0.0
is incompatible with Gatsby v2.
Install
npm install --save gatsby-plugin-preact preact
How to use
// In your gatsby-config.js
plugins: [`gatsby-plugin-preact`]
Usage in a development environment
Gatsby development server currently has a hardcoded dependency on React-dom, therefore this plugin does not enable Preact in development.
While Preact is designed to be a drop-in replacement, you should check that your production build works as expected before putting it live.