-
Notifications
You must be signed in to change notification settings - Fork 829
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
[workbox-webpack-plugin] Apply manifestTransforms to Webpack assets #1339
Comments
You're correct that manifest transformations don't apply to webpack assets. (We've tried to be clearer about that in the docs so that this doesn't catch folks by surprise.) While there are a lot of ways to use webpack, what we've found in general is that the URLs that webpack assigns to assets in manages tends to be the same URLs that can be used to access those assets once they're deployed to the web. Configuration settings that control that behavior, like For instance, you mention that you're serving a file that lives at ( |
I see your point about trusting Webpack's configuration, and I appreciate that the favicon example may not be the best one. I spent some time in my project refactoring the values around For example, the Webpack plugin that I use to generate the favicon files and the Webapp Manifest needs a In short: I agree that 99% of the times Workbox can just rely on Webpack's compilation output, but there can be edge cases where little tweaks are necessary. |
You say that those URLs end up in the precache manifest with a We can leave this open to track the general request to allow you to manipulate the precache manifest generated from your webpack assets in a future release of Workbox. I'd like to put some thought into what a properly API for that would look like, though, as I don't think you can just take whatever is currently being supplied as the Here's a suggestion for now: don't include the "problematic" URLs in your webpack-generated precache manifest, and instead pick them up by setting something like |
This is also tracked in #1227 |
I've been dealing with the same issue. precache-manifest.[hash].js file:
URLs beginning with double slash only happen with JS files. |
Yes, after seeing the webpack asset pipeline I figure out they end up with that prefix as well. I don't know why this only happens with JS files, I'm looking for a way to remove them. |
@carlosbensant did you end up resolving this? I recently ran into this and am looking for a solution. |
Yes, of course. I had to install a library to replace those prefixes in every autogenerated JS file.
|
What worked for me is just to set the publicPath to nothing:
|
You can finde the problem here as well: laravel-mix/laravel-mix#1717 |
Currently the
dontCacheBustUrlsMatching
,modifyUrlPrefix
andmanifestTransforms
options do not seem to have any effect on the precache manifest generated off Webpack's compilation assets.I'm generating some assets through Webpack that need to be served at the root of the website. Let's take
favicon.ico
as an example: the plugin precachesfavicon.ico
at the url/static/favicons/favicon.ico
, but i'm serving this asset at\favicon.ico
. The precached URL doesn't match with the request, and returns the fallback URL instead.I would normally solve the problem with the
modifyUrlPrefix
or themanifestTransforms
option, but they don't seem to apply in this case.I believe this is quite a limitation for the Webpack plugin, is there any chance these transformations can be applied to all pracached assets, including the ones coming from Webpack?
Library Affected:
workbox-webpack-plugin
,workbox-build
Browser & Platform:
N/A
Issue or Feature Request Description:
Issue
The text was updated successfully, but these errors were encountered: