lettertwo / appcache-webpack-plugin Goto Github PK
View Code? Open in Web Editor NEWGenerate an HTML5 Application Cache for a Webpack build
Generate an HTML5 Application Cache for a Webpack build
When webpack started with --watch option, the plugin generate full manifest for the first time (OK), but when a watched fie is changed and webpack regenerate outputs, the plugin regenerate the appcache manifest, but it contains only changed files. Unchanged files processed with file-loader are not included nor files from copy-webpack-plugin.
Hello ๐
I am using the plugin for application. It works on desktop and in mobile device (iPhone 5s, iOS 11, Safari). Cache works great and I can use the appication without internet connection.
But, unfortunately, after some hours I can't use it without internet connection and I see the message "Safari cannot open the page because your iPhone is not connected to the internet".๐ณ
Does cache have lifetime limit?
Or, I think, after some time, iOS starts offload unused data and delete cache. ๐ค
Does anyone has the same problem?
At the very least, make naming of the appcache manifest file configurable.
We use a build that exports multiple cache manifests, for different devices/platforms. Something like:
plugins: [
new AppCachePlugin({
exclude: [/ios/],
name: "android.appcache"
}),
new AppCachePlugin({
exclude: [/android/],
name: "ios.appcache"
})
]
Problem is, that produces an iOS appcache that includes the android appcache! I can't think of any reason why anyone would want to cache the appcache, and in fact that can lead to an impossible-to-update application.
Should we automatically exclude /\/\.appcache$/
files?
In your typical webpack config, you can specify the output filename to have hash in it: index-[chunkhash].js
, etc. It would be nice if we could do that with the appcache so we don't have caching issues.
When used with webpack 3.0.0 npm reported a warning
npm WARN [email protected] requires a peer of webpack@>=0.11 <2.0.0 || >=2.1.0-beta.13 <3.0.0 but none was installed.
We recently upgraded to webpack 4 and noticing the forward slash has been replaced with %5C in the manifest appcache. I see similar issues posted in the past and have been fixed.
We never had issues in the path only after upgrading to webpack 4, seeing this issue. Let us know the steps to fix it.
Eg: theme%5Cbase.css
Version: [email protected]
Conversely, maybe allow only some assets to be included.
new AppcachePlugin
include: [
/.*\.js$/
/.*\.svg$/
]
exclude: [
/.*\/.js\/.map$/
/\/thing\.js$/
/\/icons\/.*\.svg$/
]
new AppCacheWebpackPlugin({
comments: [
'[hash][YYYY-MM-DD HH:mm:ss]', // compilation hash, compilation time in moment.js format
'some other comments'
]
})
Compilation hash info. is easy to lose, we have to record each release's compilation somewhere, so we need compilation time to known it's which version.
And when I use html-webpack-plugin to generate html file, I just modify the html file template, the compilation hash does not change, maybe it's html-webpack-plugin's duty to update compilation hash, but there are still some edge cases to need additional comments in appcache manifest file.
(node:42631) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
at AppCachePlugin.apply (/Users/chet/Code/notion-next/node_modules/appcache-webpack-plugin/lib/index.js:100:16)
at webpack (/Users/chet/Code/notion-next/node_modules/webpack/lib/webpack.js:37:12)
at Object.<anonymous> (/Users/chet/Code/notion-next/src/cli/webpack.ts:39:19)
at step (/Users/chet/Code/notion-next/src/cli/webpack.ts:32:23)
at Object.next (/Users/chet/Code/notion-next/src/cli/webpack.ts:13:53)
at /Users/chet/Code/notion-next/src/cli/webpack.ts:7:71
at new Promise (<anonymous>)
at __awaiter (/Users/chet/Code/notion-next/src/cli/webpack.ts:3:12)
at Object.build [as default] (/Users/chet/Code/notion-next/src/cli/webpack.ts:51:12)
at Object.<anonymous> (/Users/chet/Code/notion-next/src/cli/client.ts:38:20)
dotfiles (files starting with a .
, e.g. .htaccess
) cannot get requested by a browser, results in a 403 error. (src: https://support.hostgator.com/articles/403-forbidden-or-no-permission-to-access) So putting them in an appcache manifest doesn't really make sense. Would be nice if this plugin excluded all dotfiles automatically.
Great work on this plugin, absolutely love it!
Edit: Generalized the issue, since it occurs with all configs.
manifest.appcache
is listed as the last item in the CACHE MANIFEST
section of the manifest file...
CACHE MANIFEST
# 0d69541ac542a8c13716
[...snipped lots of stuff...]
index.html
manifest.appcache
While, as far as I can tell, this doesn't cause any problems, it doesn't seem like a good idea.
here is my setting up:
new CopyWebpackPlugin([
{ from: './src/contacts.json' },
{ from: './src/offline.html' }
]),
new AppCachePlugin({
cache: [],
network: ['contact.json'],
fallback: ['offline.html'],
exclude: [
'contact.json',
'offline.html'
],
output: 'angular4-ts-webpack2.manifest.appcache'
})
CACHE MANIFEST
# 8f733b00f56b5349ae47
images/Iverson.599c733dcdf601a1.jpg
scripts/0.DetailModule.d6af6f108f3b17cd.js
scripts/polyfills.8ec46231416fd920.js
scripts/app.a1811fb437250cea.js
scripts/vendor.a52b3c4b85c4f901.js
scripts/0.DetailModule.d6af6f108f3b17cd.js.map
scripts/polyfills.8ec46231416fd920.js.map
scripts/app.a1811fb437250cea.js.map
scripts/vendor.a52b3c4b85c4f901.js.map
scripts/0.DetailModule.d6af6f108f3b17cd.js.gz
scripts/polyfills.8ec46231416fd920.js.gz
scripts/app.a1811fb437250cea.js.gz
scripts/vendor.a52b3c4b85c4f901.js.gz
index.html
contacts.json
NETWORK:
contact.json
FALLBACK:
offline.html
pay attention to the contact.json
file. This file should not be in CACHE
list.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.