gatsby-node.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /**
  2. * Implement Gatsby's Node APIs in this file.
  3. *
  4. * See: https://www.gatsbyjs.com/docs/node-apis/
  5. */
  6. const webpack = require("webpack");
  7. exports.onCreateWebpackConfig = function addPathMapping({
  8. stage,
  9. actions,
  10. getConfig,
  11. }) {
  12. actions.setWebpackConfig({
  13. experiments: {
  14. asyncWebAssembly: true,
  15. },
  16. plugins: [
  17. // Work around for Buffer is undefined:
  18. // https://github.com/webpack/changelog-v5/issues/10
  19. new webpack.ProvidePlugin({
  20. Buffer: ["buffer", "Buffer"],
  21. }),
  22. ],
  23. resolve: {
  24. fallback: {
  25. buffer: require.resolve("buffer"),
  26. fs: false,
  27. path: false,
  28. stream: require.resolve("stream-browserify"),
  29. },
  30. },
  31. });
  32. };
  33. exports.createPages = ({ actions }) => {
  34. const { createRedirect } = actions;
  35. createRedirect({
  36. fromPath: "/en/",
  37. toPath: "/",
  38. isPermanent: true,
  39. });
  40. createRedirect({
  41. fromPath: "/en/about/",
  42. toPath: "/buidl/",
  43. isPermanent: true,
  44. });
  45. createRedirect({
  46. fromPath: "/en/network/",
  47. toPath: "/network/",
  48. isPermanent: true,
  49. });
  50. createRedirect({
  51. fromPath: "/en/explorer/",
  52. toPath: "/explorer/",
  53. isPermanent: true,
  54. });
  55. };