update webpack stuff
This commit is contained in:
parent
4565d0858f
commit
33502dbd84
@ -2,7 +2,7 @@ const path = require('path')
|
|||||||
const TerserPlugin = require('terser-webpack-plugin')
|
const TerserPlugin = require('terser-webpack-plugin')
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
const CopyPlugin = require('copy-webpack-plugin')
|
const CopyPlugin = require('copy-webpack-plugin')
|
||||||
const { InjectManifest } = require('workbox-webpack-plugin')
|
const { GenerateSW } = require('workbox-webpack-plugin')
|
||||||
const ImageminPlugin = require('imagemin-webpack-plugin').default
|
const ImageminPlugin = require('imagemin-webpack-plugin').default
|
||||||
const ImageminWebpWebpackPlugin = require('imagemin-webp-webpack-plugin')
|
const ImageminWebpWebpackPlugin = require('imagemin-webp-webpack-plugin')
|
||||||
const ImageminJpegifyWebpackPlugin = require('./.imagemin-jpgify-webpack-plugin.js')
|
const ImageminJpegifyWebpackPlugin = require('./.imagemin-jpgify-webpack-plugin.js')
|
||||||
@ -49,22 +49,18 @@ const htmlMin = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const productionPlugins = [
|
const productionPlugins = [
|
||||||
new InjectManifest({
|
new GenerateSW({
|
||||||
importWorkboxFrom: 'local',
|
navigateFallback: '/index.html',
|
||||||
swSrc: magicFile(`
|
clientsClaim: true,
|
||||||
workbox.core.skipWaiting();
|
skipWaiting: true,
|
||||||
workbox.core.clientsClaim();
|
|
||||||
workbox.precaching.cleanupOutdatedCaches()
|
|
||||||
workbox.routing.registerNavigationRoute('/index.html');
|
|
||||||
workbox.precaching.precacheAndRoute(self.__precacheManifest);
|
|
||||||
`),
|
|
||||||
swDest: 'sw.js',
|
swDest: 'sw.js',
|
||||||
}),
|
}),
|
||||||
// TODO: build .l.pngs into jpgs
|
// smallen images
|
||||||
new ImageminPlugin({
|
new ImageminPlugin({
|
||||||
jpegtran: { progressive: true },
|
jpegtran: { progressive: true },
|
||||||
svgo: null,
|
svgo: null,
|
||||||
}),
|
}),
|
||||||
|
// make the webps (.l.png is for lossy)
|
||||||
new ImageminWebpWebpackPlugin({
|
new ImageminWebpWebpackPlugin({
|
||||||
config: [{
|
config: [{
|
||||||
test: /\.jpe?g$/,
|
test: /\.jpe?g$/,
|
||||||
@ -90,6 +86,7 @@ const productionPlugins = [
|
|||||||
silent: true,
|
silent: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
}),
|
}),
|
||||||
|
// make jpgs out of .l.pngs too
|
||||||
new ImageminJpegifyWebpackPlugin({
|
new ImageminJpegifyWebpackPlugin({
|
||||||
config: [{
|
config: [{
|
||||||
test: /\.l\.png$/,
|
test: /\.l\.png$/,
|
||||||
|
Loading…
Reference in New Issue
Block a user