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": [ "headers": [
{ {
"source": "**/*.@(jpg|jpeg|gif|png|webm|mp4)", "source": "**/*.@(jpg|jpeg|webp|png|webm|mp4|gif)",
"headers": [ "headers": [
{ {
"key": "Cache-Control", "key": "Cache-Control",

View file

@ -5,7 +5,7 @@
"scripts": { "scripts": {
"start": "webpack-dev-server --mode development", "start": "webpack-dev-server --mode development",
"lint": "npx eslint --fix \"src/**/*.ts\" && npx prettier --write \"src/**/*\"", "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": { "repository": {
"type": "git", "type": "git",

View file

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