feat: added offline-plugin

This commit is contained in:
NGPixel 2018-01-27 22:06:18 -05:00
parent 63902907b5
commit 75d37cbdaf
4 changed files with 27 additions and 3 deletions

View File

@ -2,4 +2,5 @@
require('./scss/app.scss') require('./scss/app.scss')
require('./js/compatibility.js') require('./js/compatibility.js')
require('offline-plugin/runtime').install()
require('./js/app.js') require('./js/app.js')

View File

@ -4,6 +4,7 @@ const merge = require('webpack-merge')
const CleanWebpackPlugin = require('clean-webpack-plugin') const CleanWebpackPlugin = require('clean-webpack-plugin')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin') const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin') const ExtractTextPlugin = require('extract-text-webpack-plugin')
const OfflinePlugin = require('offline-plugin')
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin') const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin')
const common = require('./webpack.common.js') const common = require('./webpack.common.js')
@ -21,6 +22,17 @@ module.exports = merge(common, {
'process.env.NODE_ENV': JSON.stringify('production') 'process.env.NODE_ENV': JSON.stringify('production')
}), }),
new ExtractTextPlugin('css/bundle.css'), new ExtractTextPlugin('css/bundle.css'),
new OfflinePlugin({
caches: {
main: [
'js/runtime.js',
'js/vendor.js',
'js/client.js'
],
additional: [':externals:'],
optional: ['*.chunk.js']
}
}),
new DuplicatePackageCheckerPlugin() new DuplicatePackageCheckerPlugin()
] ]
}) })

View File

@ -177,6 +177,7 @@
"node-dev": "3.1.3", "node-dev": "3.1.3",
"node-sass": "4.7.2", "node-sass": "4.7.2",
"nodemon": "1.14.11", "nodemon": "1.14.11",
"offline-plugin": "4.9.0",
"postcss-loader": "2.0.10", "postcss-loader": "2.0.10",
"postcss-selector-parser": "3.1.1", "postcss-selector-parser": "3.1.1",
"progress-bar-webpack-plugin": "1.10.0", "progress-bar-webpack-plugin": "1.10.0",

View File

@ -3022,7 +3022,7 @@ decompress-response@^3.2.0:
dependencies: dependencies:
mimic-response "^1.0.0" mimic-response "^1.0.0"
deep-extend@~0.4.0, deep-extend@~0.4.1: deep-extend@^0.4.0, deep-extend@~0.4.0, deep-extend@~0.4.1:
version "0.4.2" version "0.4.2"
resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.4.2.tgz#48b699c27e334bf89f10892be432f6e4c7d34a7f"
@ -3329,7 +3329,7 @@ ee-first@1.1.1:
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
ejs@^2.5.6: ejs@^2.3.4, ejs@^2.5.6:
version "2.5.7" version "2.5.7"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a"
@ -6260,7 +6260,7 @@ loader-runner@^2.3.0:
version "2.3.0" version "2.3.0"
resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.3.0.tgz#f482aea82d543e07921700d5a46ef26fdac6b8a2"
loader-utils@^0.2.15: loader-utils@0.2.x, loader-utils@^0.2.15:
version "0.2.17" version "0.2.17"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348" resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-0.2.17.tgz#f86e6374d43205a6e6c60e9196f17c0299bfb348"
dependencies: dependencies:
@ -7408,6 +7408,16 @@ object.pick@^1.3.0:
dependencies: dependencies:
isobject "^3.0.1" isobject "^3.0.1"
offline-plugin@4.9.0:
version "4.9.0"
resolved "https://registry.yarnpkg.com/offline-plugin/-/offline-plugin-4.9.0.tgz#0874960c0cb0c249f96b7cfc674217934660ed5c"
dependencies:
deep-extend "^0.4.0"
ejs "^2.3.4"
loader-utils "0.2.x"
minimatch "^3.0.3"
slash "^1.0.0"
on-finished@^2.3.0, on-finished@~2.3.0: on-finished@^2.3.0, on-finished@~2.3.0:
version "2.3.0" version "2.3.0"
resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947"