diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2018-06-02 11:50:49 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2018-12-13 17:09:11 +0100 |
| commit | 7cc84923fdb59956890f69fe6363d9ab333cf46a (patch) | |
| tree | 165f24fcda9dcca032d7cdfeacb6bec58a52d73d /webpack.config.js | |
| parent | 0cd076c85f05fad581ae3ac34338e20e443ecdb1 (diff) | |
| download | brokentalents-7cc84923fdb59956890f69fe6363d9ab333cf46a.tar.gz brokentalents-7cc84923fdb59956890f69fe6363d9ab333cf46a.zip | |
Create a PWA
Diffstat (limited to 'webpack.config.js')
| -rw-r--r-- | webpack.config.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/webpack.config.js b/webpack.config.js index a33084c..b36ac0b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,12 +1,14 @@ +const path = require('path'); const VueLoaderPlugin = require('vue-loader/lib/plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin'); +const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin'); module.exports = { - entry: __dirname + '/src/index.js', + entry: path.resolve(__dirname, 'src/index.js'), output: { - path: __dirname + '/dist/', + path: path.resolve(__dirname, 'dist/'), filename: 'build.js', }, module: { @@ -41,5 +43,11 @@ module.exports = { new MiniCssExtractPlugin({ }), new OptimizeCssAssetsPlugin(), - ], + ].concat(process.env.NODE_ENV == 'production' ? [ + new SWPrecacheWebpackPlugin({ + cacheId: 'brokentalents-1', + filepath: '../service-worker.js', + minify: true, + }), + ] : []), }; |
