-
Notifications
You must be signed in to change notification settings - Fork 81
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
是否有考虑过添加到构建过程中的方案? #2
Comments
https://github.com/shirotech/webpack-cdn-plugin |
有考虑过。最早的方案(Service Worker 之前)就是在构建过程中把本地 URL 替换成 CDN URL 的,后来用 Service Worker 就没考虑了,希望尽量不改已有的业务代码,除了每个页面插入一个 JS(这一步倒是可以在构建过程中插入)。 之后可以提供一些,比如公共库 JS 的搜索,根据文件 Hash 查询各个 CDN 的 URL,很多项目都可以用到。 |
构建过程是可以生成自动加载的Service Worker文件的,可以参考一下 先通过workbox根据资源生成Service Worker文件 |
如果有 webpack 插件的确更容易上手一些,也更方便整合进现有的构建流程。 |
如果能做一个gulp插件或hexo插件就好了,根据HTML里的CDN链接自动生成SW之类...? |
例如支持webpack和rollup,通过构建生成的产物来生成loader
这样做有几个好处:
1、可以编辑html输出来将loader放在最开始加载
2、构建过程可以读取依赖包列表,转换成对应的cdn源
The text was updated successfully, but these errors were encountered: