forked from tinacms/tina.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
61 lines (52 loc) · 1.55 KB
/
next.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
const MomentLocalesPlugin = require('moment-locales-webpack-plugin')
const withSvgr = require('next-svgr')
require('dotenv').config()
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true',
})
const dummyMailchimpEndpoint =
'https://theDomainHere.us18.list-manage.com/subscribe/post?u=1512315231252&id=0asd21t12e1'
const config = {
env: {
MAILCHIMP_ADDRESS: process.env.MAILCHIMP_ADDRESS || dummyMailchimpEndpoint,
HUBSPOT_TEAMS_FORM_ID: process.env.HUBSPOT_TEAMS_FORM_ID,
HUBSPOT_PORTAL_ID: process.env.HUBSPOT_PORTAL_ID,
GTM_ID: process.env.GTM_ID,
},
//avoiding CORS error, more here: https://vercel.com/support/articles/how-to-enable-cors
async headers() {
return [
{
source: '/(.*)',
headers: [
{
key: 'Access-Control-Allow-Origin',
value: '*',
},
{
key: 'Access-Control-Allow-Methods',
value: 'GET,OPTIONS,PATCH,DELETE,POST,PUT',
},
{
key: 'Access-Control-Allow-Headers',
value: 'Accept, Content-Length, Content-Type',
},
],
},
]
},
trailingSlash: true,
exportPathMap: async function() {
return {}
},
webpack(config) {
config.module.rules.push({
test: /\.md$/,
use: 'raw-loader',
})
config.resolve.fallback = { ...config.resolve.fallback, fs: 'empty' }
config.plugins.push(new MomentLocalesPlugin())
return config
},
}
module.exports = withBundleAnalyzer(withSvgr(config))