-
Notifications
You must be signed in to change notification settings - Fork 0
/
gatsby-config.js
141 lines (139 loc) · 3.91 KB
/
gatsby-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
})
const connectSystemFiles = [
{ name: 'images', path: `${__dirname}/src/images` },
{ name: 'data', path: `${__dirname}/src/` },
{ name: 'translations', path: `${__dirname}/static/locales` },
].map(options => ({ resolve: 'gatsby-source-filesystem', options }))
module.exports = {
pathPrefix: `/react-project`, //repository name
proxy: {
prefix: '/api',
url: process.env.API_URL,
},
siteMetadata: {
title: 'React Project',
description: 'Description',
author: 'Lyulyaev Maxim',
apiUrl: process.env.API_URL,
siteUrl: `https://www.example.com`,
},
plugins: [
/*{
resolve: 'gatsby-plugin-eslint',
options: {
test: /\.js$|\.jsx$/,
stages: ['develop', 'build-javascript'],
exclude: /(node_modules|.cache|public)/,
options: {
emitWarning: true,
failOnError: false,
},
},
},*/
{
resolve: `gatsby-plugin-typescript`,
options: {
isTSX: true,
allExtensions: true,
},
},
'gatsby-plugin-typescript-checker',
'gatsby-plugin-react-helmet',
'gatsby-plugin-transition-link',
...connectSystemFiles,
'gatsby-transformer-json',
/* images: optimizations and GraphQL */
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
/*{
resolve: 'gatsby-source-mongodb',
options: {
dbName: `cloud`,
collection: `documents`,
server: { address: `ds143532.mlab.com`, port: 43532 },
auth: { user: `admin`, password: `12345` },
map: { documents: { description: `text/markdown` } },
},
},*/
/*{
resolve: "gatsby-source-graphql",
options: {
typeName: "GitHub",
fieldName: "github",
url: "https://api.github.com/graphql",
headers: {
Authorization: `bearer ${process.env.GITHUB_TOKEN}`,
},
fetchOptions: {},
},
},*/
// @gatsby-contrib/gatsby-plugin-elasticlunr-search
{
resolve: `gatsby-plugin-material-ui`,
options: {
stylesProvider: {
injectFirst: true,
},
},
},
'gatsby-plugin-emotion',
//although intended for SC, but help Emotion with a compact displaying in DevTools
'gatsby-plugin-styled-components',
{
resolve: 'gatsby-plugin-postcss',
options: {
postCssPlugins: require('./configs/postcss.config').plugins,
// cssLoaderOptions: { camelCase: false }
},
},
'gatsby-plugin-sitemap',
/*'gatsby-plugin-feed', //for RSS */
/*---------------- for PWA ----------------*/
{
resolve: 'gatsby-plugin-manifest',
options: {
name: 'ReactProject',
short_name: 'ReactProject',
start_url: '/',
background_color: '#663399',
theme_color: '#663399',
icon: 'src/images/gatsby-icon.png',
display: 'minimal-ui',
},
},
'gatsby-plugin-offline',
/*{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: "YOUR_GOOGLE_ANALYTICS_TRACKING_ID",
head: false,
anonymize: true,
respectDNT: true,
exclude: ["/preview/!**", "/do-not-track/me/too/"],
optimizeId: "YOUR_GOOGLE_OPTIMIZE_TRACKING_ID",
experimentId: "YOUR_GOOGLE_EXPERIMENT_ID",
variationId: "YOUR_GOOGLE_OPTIMIZE_VARIATION_ID",
sampleRate: 5,
siteSpeedSampleRate: 10,
cookieDomain: "example.com",
},
},
//preloading with using Machine Learning and Google Analytics
{
resolve: "gatsby-plugin-guess-js",
options: {
// Find the view id in the GA admin in a section labeled "views"
GAViewID: `VIEW_ID`,
minimumThreshold: 0.03,
// The "period" for fetching analytic data.
period: {
startDate: new Date("2018-1-1"),
endDate: new Date(),
},
},
},
*/
],
}