2021-03-06 01:29:28 +01:00
|
|
|
const { merge } = require('webpack-merge')
|
|
|
|
const common = require('./webpack.common.js')
|
|
|
|
|
|
|
|
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
|
|
|
|
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
|
2023-08-09 18:36:27 +03:00
|
|
|
const WorkboxPlugin = require('workbox-webpack-plugin')
|
2021-03-06 01:29:28 +01:00
|
|
|
const webpack = require('webpack')
|
|
|
|
|
|
|
|
module.exports = merge(common, {
|
|
|
|
mode: 'production',
|
2023-08-11 04:21:41 +03:00
|
|
|
devtool: 'source-map',
|
2021-03-06 01:29:28 +01:00
|
|
|
plugins: [
|
|
|
|
new CleanWebpackPlugin(),
|
|
|
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
2023-08-09 18:36:27 +03:00
|
|
|
new LodashModuleReplacementPlugin(),
|
|
|
|
new WorkboxPlugin.GenerateSW({
|
|
|
|
// these options encourage the ServiceWorkers to get in there fast
|
|
|
|
// and not allow any straggling "old" SWs to hang around
|
|
|
|
clientsClaim: true,
|
|
|
|
skipWaiting: true,
|
|
|
|
include: ['index.html', 'manifest.json'] // not caching a lot as anyway this works only online
|
|
|
|
}),
|
2023-08-11 04:21:41 +03:00
|
|
|
new webpack.ProvidePlugin({
|
|
|
|
// get from github actions or vercel env
|
|
|
|
GITHUB_URL: process.env.VERCEL_GIT_REPO_OWNER
|
|
|
|
? `https://github.com/${process.env.VERCEL_GIT_REPO_OWNER}/${process.env.VERCEL_GIT_REPO_SLUG}`
|
|
|
|
: process.env.GITHUB_REPOSITORY
|
|
|
|
})
|
|
|
|
],
|
2021-03-06 01:29:28 +01:00
|
|
|
})
|