This repository was archived by the owner on Jun 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnext.config.js
More file actions
133 lines (105 loc) · 2.93 KB
/
Copy pathnext.config.js
File metadata and controls
133 lines (105 loc) · 2.93 KB
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
// function moduleExists(name) {
// try {
// return require.resolve(name);
// } catch (error) {
// return false;
// }
// }
// const webpack = require('webpack')
// if (process.env.NODE_ENV !== 'production') {
// require('now-env')
// }
// const withOffline = moduleExists('next-offline')
// ? require('next-offline')
// : {};
/**
* If some of the envs are public, like a google maps key, but you still
* want to keep them secret from the repo, the following code will allow you
* to share some variables with the client, configured at compile time.
*/
// module.exports = {
// webpack: config => {
// config.plugins.push(
// new webpack.DefinePlugin({
// 'process.env.ENV': JSON.stringify(process.env.ENV)
// })
// // Same as above
// // new webpack.EnvironmentPlugin(['SECRET'])
// )
// return config
// }
// }
// const withSass = require('@zeit/next-sass')
const withCSS = require('@zeit/next-css')
// const withSourceMaps = require('@zeit/next-source-maps')
// module.exports = withCSS(
// withSourceMaps(
// withSass({
// sassLoaderOptions: {
// precision: 2
// }
// })
// )
// );
// module.exports = withCSS(
// withSass({
// sassLoaderOptions: {
// precision: 2
// }
// })
// );
// module.exports = withSass();
// module.exports = withCSS();
// console.log(">>>>>>> next.config.js process.env.ENV -->>>", process.env.ENV)
const nextConfig = {
target: 'serverless',
env: {
ENV: process.env.ENV,
FILEPOND_API_ENDPOINT: process.env.FILEPOND_API_ENDPOINT ? process.env.FILEPOND_API_ENDPOINT : '',
FILEPOND_API_URL: process.env.FILEPOND_API_URL ? process.env.FILEPOND_API_URL : '',
SALT: process.env.SALT
},
webpack: (config) => {
config.module.rules.push({
test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: {
loader: 'url-loader',
options: {
limit: 100000,
name: '[name].[ext]'
}
}
})
return config
}
}
console.log("=========================");
console.log('process.env.NODE_ENV:', process.env.NODE_ENV);
console.log("=========================");
// module.exports = (process.env.NODE_ENV === 'production')
// ? moduleExists('next-offline')
// ? withOffline(withCSS(Object.assign({}, nextConfig, {
// workboxOpts: {
// swDest: 'static/service-worker.js',
// runtimeCaching: [
// {
// urlPattern: /^https?.*/,
// handler: 'networkFirst',
// options: {
// cacheName: 'https-calls',
// networkTimeoutSeconds: 15,
// expiration: {
// maxEntries: 150,
// maxAgeSeconds: 30 * 24 * 60 * 60, // 1 month
// },
// cacheableResponse: {
// statuses: [0, 200],
// },
// },
// },
// ],
// }
// })))
// : withCSS(nextConfig)
// : withCSS(nextConfig);
module.exports = withCSS(nextConfig);