Эта конфигурация сработала для меня. Я не добавил babel-plugin-import
и не изменил gatsby-node.js
файл.
Вот мой package.json
файл
{
"name": "web-master",
"private": true,
"description": "Become a fullstack developer",
"version": "1.0",
"author": "Vishal Shetty",
"dependencies": {
"gatsby": "^2.19.7",
"gatsby-image": "^2.2.39",
"gatsby-plugin-manifest": "^2.2.39",
"gatsby-plugin-offline": "^3.0.32",
"gatsby-plugin-react-helmet": "^3.1.21",
"gatsby-plugin-sharp": "^2.4.3",
"gatsby-source-filesystem": "^2.1.46",
"gatsby-transformer-sharp": "^2.3.13",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-helmet": "^5.2.1"
},
"devDependencies": {
"antd": "^3.26.12",
"gatsby-plugin-antd": "^2.1.0",
"gatsby-plugin-less": "^3.0.19",
"less": "^3.11.1",
"less-loader": "^5.0.0",
"prettier": "^1.19.1"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md}\"",
"start": "npm run develop",
"serve": "gatsby serve",
"clean": "gatsby clean"
}
}
Мой gatsby-config.js
файл
module.exports = {
siteMetadata: {
title: `WebMaster`,
description: `Become a fullstack developer`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
},
},
{
resolve: "gatsby-plugin-antd",
options: {
style: true,
},
},
{
resolve: "gatsby-plugin-less",
options: {
javascriptEnabled: true,
modifyVars: {
"primary-color": "#E4572E",
},
},
},
],
}
Обратите внимание на конфигурацию плагинов gatsby-plugin-antd
и gatsby-plugin-less
.
Вот и все, работает.
person
Vishal Shetty
schedule
25.02.2020