OS: window 10
I am making a blog using gatsby. During the production process, I changed the gatsby-config.js file as follows, but an error similar to the picture occurred.
[before]
module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
{
resolve: 'gatsby-plugin-typescript',
options: {
isTSX: true,
allExtensions: true,
},
},
`gatsby-plugin-emotion`,
`gatsby-plugin-react-helmet`,
// {
// resolve: `gatsby-source-filesystem`,
// options: {
// name: `contents`,
// path: `${__dirname}/contents`,
// },
// },
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: <https://gatsby.dev/offline>
// `gatsby-plugin-offline`,
],
};
[after]
module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
{
resolve: 'gatsby-plugin-typescript',
options: {
isTSX: true,
allExtensions: true,
},
},
`gatsby-plugin-emotion`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `contents`,
path: `${__dirname}/contents`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: 'gatsby-remark-smartypants',
options: {
dashes: 'oldschool',
},
},
{
resolve: 'gatsby-remark-prismjs',
options: {
classPrefix: 'language-',
},
},
{
resolve: 'gatsby-remark-images',
options: {
maxWidth: 768,
quality: 100,
withWebp: true,
},
},
{
resolve: 'gatsby-remark-copy-linked-files',
options: {},
},
{
resolve: 'gatsby-remark-external-links',
options: {
target: '_blank',
rel: 'nofollow',
},
},
],
},
},
],
};
I tried various solutions through Google.
node fetch reinstall, package.json 's type = module change
No effort was successful.
They say it's an import problem, but I don't know why it suddenly became an import problem.
