96 lines
2.6 KiB
JavaScript
96 lines
2.6 KiB
JavaScript
// next.config.js
|
|
const withPlugins = require('next-compose-plugins')
|
|
const optimizedImages = require('next-optimized-images')
|
|
const webpack = require("webpack")
|
|
const withCSS = require('@ostai/next-css')
|
|
const withOffline = require('next-offline')
|
|
|
|
const { ANALYZE, DEV } = process.env
|
|
|
|
module.exports = withPlugins([
|
|
[withCSS],
|
|
[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'
|
|
]
|
|
},
|
|
|
|
}],
|
|
|
|
[{
|
|
publicRuntimeConfig: {
|
|
|
|
adListDefaultUrl: "https://www.talentstube.com/img/default_picture_company.svg",
|
|
logoRootUrl: 'https://www.talentstube.com/media/cache/profile_thumb/uploads/img/'
|
|
}
|
|
}]],
|
|
{
|
|
webpack: (config, { isServer }) => {
|
|
|
|
if (ANALYZE) {
|
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
|
|
|
config.plugins.push(new BundleAnalyzerPlugin({
|
|
analyzerMode: 'server',
|
|
analyzerPort: isServer ? 8888 : 8889,
|
|
openAnalyzer: true
|
|
}))
|
|
}
|
|
const videojsPlugin = new webpack.ProvidePlugin({
|
|
videojs: "video.js/dist/video.cjs.js",
|
|
RecordRTC: "recordrtc",
|
|
MediaStreamRecorder: ["recordrtc", "MediaStreamRecorder"]
|
|
});
|
|
const videojsAlias = {
|
|
videojs: "video.js",
|
|
WaveSurfer: "wavesurfer.js",
|
|
RecordRTC: "recordrtc"
|
|
};
|
|
|
|
|
|
config.resolve.alias = { ...config.resolve.alias, ...videojsAlias };
|
|
config.plugins.push(videojsPlugin);
|
|
|
|
// config.module.rules.push(
|
|
// {
|
|
// test: /\.css$/,
|
|
// loader: 'style-loader!css-loader',
|
|
// include: [/node_modules/]
|
|
// },
|
|
|
|
// )
|
|
|
|
console.log(config);
|
|
return config
|
|
}
|
|
},
|
|
{
|
|
generateBuildId: async () => {
|
|
// For example get the latest git commit hash here
|
|
|
|
return 'v0.1.0'
|
|
}
|
|
},
|
|
|
|
); |