gatsby-node.js 639 B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * Implement Gatsby's Node APIs in this file.
  3. *
  4. * See: https://www.gatsbyjs.org/docs/node-apis/
  5. */
  6. // You can delete this file if you're not using it
  7. exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
  8. let rules = [
  9. {
  10. test: /\.mjs$/,
  11. include: /node_modules/,
  12. type: 'javascript/auto',
  13. },
  14. ]
  15. if(stage === 'build-html'){
  16. rules.push({
  17. test: /openpgp/,
  18. use: loaders.null()
  19. })
  20. }
  21. actions.setWebpackConfig({
  22. resolve: {
  23. extensions: ['*', '.mjs', '.jsx', '.js', '.json'],
  24. },
  25. module: {
  26. rules: [
  27. ...rules
  28. ]
  29. },
  30. });
  31. };