service-worker - 如何使用资产路径自定义工作箱构建以进行预兑现
问题描述
我正在设置一个自定义配置来生成服务工作者。我正在使用injectManifest。问题是我的资产部署到与应用程序运行不同域的 s3 存储桶。
我已经阅读了所有的dos,但还没有找到任何配置选项。
const buildSW = () => {
// This will return a Promise
return workboxBuild
.injectManifest({
swSrc: 'src/sw-template.js',
swDest: 'build/sw.js', // this will be created in the build step
globDirectory: 'build',
globPatterns: ['**\/*.{js, html}'],
})
.then(({ count, size, warnings }) => {
// Optionally, log any warnings and details.
warnings.forEach(console.warn);
console.log(`${count} files will be precached, totaling ${size} bytes.`);
});
};
buildSW();
我收到如下配置:
"url": "static/js/runtime~main.ccae3505.js",
"revision": "51731239672d142923190a6cfb73ce8b"
},
但想要类似的东西
"url": "https://myCustomDomain.com/static/js/runtime~main.ccae3505.js",
"revision": "51731239672d142923190a6cfb73ce8b"
},```
解决方案
我找到了-希望它对某人有用:
manifestTransforms
可以解决问题
推荐阅读
- ruby - 使用 google auth gem 从 ruby 客户端通过 HTTP 访问 Cloud Function
- android - Android保存自定义数组包含位图
- time-series - 如何将二阶差转换回原始值?
- gnuplot - 如何在 gnuplot 中绘制带有 x1、y1 和 x2、y2 轴的水平条形图?
- c++ - 如何编写联合类型的扣除指南
- computer-vision - OpenCV 记录比它提供的输出文件长
- python - FLASK 上传损坏的图像
- node.js - SQL 注入问题 Nodejs MSSQL 模板字面量
- javascript - graphql-type-json 的实现
- linear-programming - C++如何使用COIN-OR排练库?