Book Pauk 5 лет назад
Родитель
Сommit
6e690f3fea
4 измененных файлов с 10 добавлено и 2 удалено
  1. 3 1
      build/webpack.prod.config.js
  2. 1 1
      client/index.html.template
  3. 5 0
      package-lock.json
  4. 1 0
      package.json

+ 3 - 1
build/webpack.prod.config.js

@@ -9,6 +9,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
 const CleanWebpackPlugin = require('clean-webpack-plugin');
 const HtmlWebpackPlugin = require('html-webpack-plugin');
 const CopyWebpackPlugin = require('copy-webpack-plugin');
+const AppCachePlugin = require('appcache-webpack-plugin');
 
 const publicDir = path.resolve(__dirname, '../dist/tmp/public');
 const clientDir = path.resolve(__dirname, '../client');
@@ -53,6 +54,7 @@ module.exports = merge(baseWpConfig, {
             template: `${clientDir}/index.html.template`,
             filename: `${publicDir}/index.html`
         }),
-        new CopyWebpackPlugin([{from: `${clientDir}/assets/*`, to: `${publicDir}/`, flatten: true}])
+        new CopyWebpackPlugin([{from: `${clientDir}/assets/*`, to: `${publicDir}/`, flatten: true}]),
+        new AppCachePlugin({})
     ]
 });

+ 1 - 1
client/index.html.template

@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html>
+<html manifest="/app/manifest.appcache">
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">

+ 5 - 0
package-lock.json

@@ -619,6 +619,11 @@
         "normalize-path": "^2.1.1"
       }
     },
+    "appcache-webpack-plugin": {
+      "version": "1.4.0",
+      "resolved": "https://registry.npmjs.org/appcache-webpack-plugin/-/appcache-webpack-plugin-1.4.0.tgz",
+      "integrity": "sha512-QA0D+3yJmpPk0CyfxYMOzhzV941rkTSjCnUEy2vS05GeqK+mMnBScQSB23lstvzYaFpkeWeLMO9RamtafhliYw=="
+    },
     "append-field": {
       "version": "1.0.0",
       "resolved": "https://registry.npmjs.org/append-field/-/append-field-1.0.0.tgz",

+ 1 - 0
package.json

@@ -55,6 +55,7 @@
     "webpack-merge": "^4.1.5"
   },
   "dependencies": {
+    "appcache-webpack-plugin": "^1.4.0",
     "axios": "^0.18.0",
     "base-x": "^3.0.5",
     "chardet": "^0.7.0",