diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js
index e7aa1220..7b3ee36a 100644
--- a/build/webpack.dev.conf.js
+++ b/build/webpack.dev.conf.js
@@ -1,10 +1,12 @@
-var utils = require('./utils')
-var webpack = require('webpack')
-var config = require('../config')
-var merge = require('webpack-merge')
-var baseWebpackConfig = require('./webpack.base.conf')
-var HtmlWebpackPlugin = require('html-webpack-plugin')
-var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
+const fs = require('fs')
+const path = require('path')
+const utils = require('./utils')
+const webpack = require('webpack')
+const config = require('../config')
+const merge = require('webpack-merge')
+const baseWebpackConfig = require('./webpack.base.conf')
+const HtmlWebpackPlugin = require('html-webpack-plugin')
+const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
// add hot-reload related code to entry chunks
Object.keys(baseWebpackConfig.entry).forEach(function (name) {
@@ -29,7 +31,9 @@ module.exports = merge(baseWebpackConfig, {
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.ejs',
- inject: true
+ inject: true,
+ serviceWorkerLoader: ``
}),
new FriendlyErrorsPlugin()
]
diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js
index cef85e59..5181842d 100644
--- a/build/webpack.prod.conf.js
+++ b/build/webpack.prod.conf.js
@@ -1,21 +1,22 @@
-var path = require('path')
-var utils = require('./utils')
-var webpack = require('webpack')
-var config = require('../config')
-var merge = require('webpack-merge')
-var baseWebpackConfig = require('./webpack.base.conf')
-var HtmlWebpackPlugin = require('html-webpack-plugin')
-var ExtractTextPlugin = require('extract-text-webpack-plugin')
-var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
-var SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin')
-var LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
-var ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin')
+const fs = require('fs')
+const path = require('path')
+const utils = require('./utils')
+const webpack = require('webpack')
+const config = require('../config')
+const merge = require('webpack-merge')
+const baseWebpackConfig = require('./webpack.base.conf')
+const HtmlWebpackPlugin = require('html-webpack-plugin')
+const ExtractTextPlugin = require('extract-text-webpack-plugin')
+const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
+const SWPrecacheWebpackPlugin = require('sw-precache-webpack-plugin')
+const LodashModuleReplacementPlugin = require('lodash-webpack-plugin')
+const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin')
-var env = process.env.NODE_ENV === 'testing'
+const env = process.env.NODE_ENV === 'testing'
? require('../config/test.env')
: config.build.env
-var webpackConfig = merge(baseWebpackConfig, {
+const webpackConfig = merge(baseWebpackConfig, {
module: {
rules: utils.styleLoaders({
sourceMap: config.build.productionSourceMap,
@@ -83,7 +84,9 @@ var webpackConfig = merge(baseWebpackConfig, {
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
- chunksSortMode: 'dependency'
+ chunksSortMode: 'dependency',
+ serviceWorkerLoader: ``
}),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
@@ -118,7 +121,7 @@ var webpackConfig = merge(baseWebpackConfig, {
})
if (config.build.productionGzip) {
- var CompressionWebpackPlugin = require('compression-webpack-plugin')
+ const CompressionWebpackPlugin = require('compression-webpack-plugin')
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
@@ -136,7 +139,7 @@ if (config.build.productionGzip) {
}
if (config.build.bundleAnalyzerReport) {
- var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
+ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
diff --git a/index.ejs b/index.ejs
index 2053150a..93f80246 100644
--- a/index.ejs
+++ b/index.ejs
@@ -47,6 +47,9 @@
+
+ <%= htmlWebpackPlugin.options.serviceWorkerLoader %>
+