gatsby-config.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import dotenv from 'dotenv';
  2. import { getThemeVariables } from 'antd/dist/theme';
  3. import supportedLanguages from './src/utils/i18n/supportedLanguages';
  4. import antdThemeOverrides from './src/AntdTheme';
  5. dotenv.config({
  6. path: `.env.${process.env.NODE_ENV}`,
  7. });
  8. const languages = supportedLanguages.map(language => language.languageTag);
  9. const plugins = [
  10. 'gatsby-plugin-react-helmet',
  11. 'gatsby-plugin-typescript',
  12. 'gatsby-plugin-remove-serviceworker',
  13. 'gatsby-plugin-svgr',
  14. {
  15. resolve: 'gatsby-plugin-intl',
  16. options: {
  17. path: `${__dirname}/src/locales`,
  18. languages,
  19. defaultLanguage: 'en',
  20. redirect: true,
  21. },
  22. },
  23. {
  24. resolve: 'gatsby-plugin-antd',
  25. options: {
  26. style: true,
  27. },
  28. },
  29. {
  30. resolve: `gatsby-plugin-less`,
  31. options: {
  32. lessOptions: {
  33. javascriptEnabled: true,
  34. modifyVars: {
  35. ...getThemeVariables({
  36. dark: true, // Enable dark mode
  37. compact: true, // Enable compact mode,
  38. }),
  39. ...antdThemeOverrides,
  40. },
  41. },
  42. },
  43. },
  44. ];
  45. // Bundle analyzer, dev only
  46. if (process.env.ENABLE_BUNDLE_ANALYZER === '1') {
  47. plugins.push('gatsby-plugin-webpack-bundle-analyser-v2');
  48. }
  49. export { plugins };