102 lines
3.3 KiB
JavaScript
102 lines
3.3 KiB
JavaScript
// next.config.js
|
|
const fetch = require('isomorphic-unfetch')
|
|
const withPlugins = require('next-compose-plugins');
|
|
|
|
const withOffline = require('next-offline')
|
|
|
|
const optimizedImages = require('next-optimized-images')
|
|
|
|
const { ANALYZE, DEV } = process.env
|
|
|
|
module.exports = withPlugins(
|
|
[
|
|
[optimizedImages, {
|
|
/* config for next-optimized-images */
|
|
}],
|
|
|
|
[withOffline, {
|
|
dontAutoRegisterSw: DEV ? true : false,
|
|
workboxOpts: {
|
|
globPatterns: ['static/**/*'],
|
|
globDirectory: '.',
|
|
runtimeCaching: [
|
|
{ urlPattern: /.*auth.*/, handler: 'networkOnly' },
|
|
{ urlPattern: /.*account.*/, handler: 'networkOnly' },
|
|
{ urlPattern: /^https?.*/, handler: 'networkFirst' },
|
|
{ urlPattern: /\.(?:png|jpg|jpeg|svg|webp)$/,
|
|
handler: "cacheFirst",
|
|
options: {
|
|
cacheName: "images",
|
|
expiration: {
|
|
maxEntries: 100
|
|
}
|
|
}}
|
|
],
|
|
importScripts:
|
|
['/static/js/firebase-messaging-sw.js',
|
|
'/static/js/backgroundSync-sw.js'
|
|
]
|
|
},
|
|
|
|
}],
|
|
[{
|
|
// serverRuntimeConfig: { // Will only be available on the server side
|
|
// // mySecret: 'secret',
|
|
// // secondSecret: process.env.SECOND_SECRET // Pass through env variables
|
|
// },
|
|
publicRuntimeConfig: { // Will be available on both server and client
|
|
staticFolder: '/static',
|
|
push: {
|
|
'defaultAction': 'https://application.bzh/' ,
|
|
'defaultIconLink': 'https://application.bzh/static/images/icons/e-declicIco152x152.png' ,
|
|
'defaultImageLink': 'https://application.bzh/static/images/banner/atc-site-web-responsive.jpg',
|
|
'topics':[
|
|
{ key: 'e-declic', value: false },
|
|
{ key: 'PWA', value: false }
|
|
]
|
|
},
|
|
apiUrl:{
|
|
'token':'https://poc-api.ag2l.fr:50000/token/',
|
|
'Qtbl_Itv_Sav': 'https://poc-api.ag2l.fr:50000/rest/server.Qtbl_Itv_Sav'
|
|
},
|
|
ReCAPTCHA:{
|
|
"siteKey":""
|
|
},
|
|
eDeclicUrl:'http://www.e-declic.com',
|
|
}}]
|
|
|
|
],
|
|
{
|
|
webpack: (config, { isServer }) => {
|
|
if (ANALYZE) {
|
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
|
|
|
config.plugins.push(new BundleAnalyzerPlugin({
|
|
analyzerMode: 'server',
|
|
analyzerPort: isServer ? 8888 : 8889,
|
|
openAnalyzer: true
|
|
}))
|
|
}
|
|
|
|
config.module.rules.push(
|
|
{
|
|
test: /\.md$/,
|
|
use: 'raw-loader'
|
|
}
|
|
)
|
|
|
|
|
|
return config
|
|
}
|
|
},
|
|
{
|
|
generateBuildId: async () => {
|
|
// For example get the latest git commit hash here
|
|
|
|
return 'v0.1.0'
|
|
}
|
|
},
|
|
|
|
|
|
|
|
); |