Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Precaching the generated WebpackPwaManifest manifest asset #1588

Closed
niveditaece opened this issue Jul 26, 2018 · 3 comments
Closed

Precaching the generated WebpackPwaManifest manifest asset #1588

niveditaece opened this issue Jul 26, 2018 · 3 comments
Labels
Bug An issue with our existing, production codebase. workbox-webpack-plugin

Comments

@niveditaece
Copy link

niveditaece commented Jul 26, 2018

*workbox-webpack-plugin.^3.4.1

Browser & Platform:
chrome,"webpack": "^4.15.0",node v10.6.0,npm 6.1.0,ubuntu 16.04

i wish to add generated manifest.json to the SWprecache array .
copied/generated manifest.json does not get included in precache-manifest.js.
This is the config i am using in webpack config:
new WebpackPwaManifest({
name: 'TestApp',
short_name: 'TestApp',
description: 'Description!',
background_color: '#01579b',
theme_color: '#01579b',
'theme-color': '#01579b',
start_url: '/',
icons: [
{
src: path.resolve('src/assets/icons/icon.png'),
sizes: [96, 128,144,152,192, 256, 384, 512],
destination: path.join('assets', 'icons')
}
]
}),
new InjectManifest({
globDirectory: '.',
globPatterns: ['dist/manifest.*.json'],
swSrc: './src/sw-default.js',
swDest: './sw.js',

})

Tried with new CopyWebpackPlugin([{from:'./src/manifest.json',to:'./assets'},{from:'./src/assets/icons',to:'assets/icons'}]),
manifest.json is precached.
but with
new CopyWebpackPlugin([{from:'./src/manifest.json'},{from:'./src/assets/icons',to:'assets/icons'}]),
it does not work -InjectManifest plugin adds manifest.json if its in assets directory but not when its in the same build directory .

Is this an issue with the plugin or should i configure it differently?
-----------Edit: got manifest.json in to precache by providing the glob directory as src and patterns as .json. But i had to generate manifest.json in the source directory to get it in to precache manifest. Please let me know if this can be achieved through plugin .

@jeffposnick jeffposnick added Bug An issue with our existing, production codebase. workbox-webpack-plugin labels Jul 26, 2018
@jeffposnick
Copy link
Contributor

I'm thinking that we might need to do something specific to pick up on the output of the WebpackPwaManifest in the list of assets that workbox-webpack-plugin knows about.

@jeffposnick jeffposnick changed the title copied/generated manifest.json does not get included in precache-manifest.js (InjectManifest) Precaching the generated WebpackPwaManifest manifest asset Jul 26, 2018
@jeffposnick jeffposnick added the P2 label Aug 3, 2018
@ivnmaksimovic
Copy link

It's a default config, not a bug? Took me a lot of time until I found this answer https://stackoverflow.com/a/52112483/2722212

Apparently exclude option excludes manifest by default with default value of [/\.map$/, /^manifest.*\.js(?:on)?$/]

Why is excluding manifest.json a reasonable default?

@piotrekwitkowski
Copy link

It's fixed in v4.0.0-alpha.0 (#1679)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An issue with our existing, production codebase. workbox-webpack-plugin
Projects
None yet
Development

No branches or pull requests

4 participants