Fix caching

This commit is contained in:
schmelczerandras 2020-11-22 22:57:27 +01:00
parent 4be519f052
commit 55bdc9dd77
3 changed files with 6 additions and 5 deletions

View file

@ -18,7 +18,7 @@
],
"headers": [
{
"source": "**/*.@(jpg|jpeg|gif|png|webm|mp4)",
"source": "**/*.@(jpg|jpeg|webp|png|webm|mp4|gif)",
"headers": [
{
"key": "Cache-Control",

View file

@ -5,7 +5,7 @@
"scripts": {
"start": "webpack-dev-server --mode development",
"lint": "npx eslint --fix \"src/**/*.ts\" && npx prettier --write \"src/**/*\"",
"build": "webpack --mode production"
"build": "webpack --mode production && rm dist/*.js && rm dist/*.css"
},
"repository": {
"type": "git",

View file

@ -45,8 +45,8 @@ module.exports = (env, argv) => ({
}),
new HtmlWebpackInlineSourcePlugin(),
new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
chunkFilename: '[id].[contenthash].css',
filename: '[name].css',
chunkFilename: '[id].css',
}),
],
entry: {
@ -54,12 +54,12 @@ module.exports = (env, argv) => ({
},
module: {
rules: [
{
test: /\.(jpe?g|png)$/i,
loader: 'responsive-loader',
options: {
adapter: Sharp,
name: '[contenthash]-[width].[ext]',
outputPath: 'static/',
sizes: [200, 400, 800, 1200, 1600, 2000],
format: 'webp',
@ -72,6 +72,7 @@ module.exports = (env, argv) => ({
loader: 'file-loader',
query: {
outputPath: 'static/',
name: '[contenthash].[ext]',
},
},
{