【发布时间】:2016-08-02 11:17:32
【问题描述】:
我正在使用 Django + Angular 2 + Webpack,在 Django 中我创建了 URL 来呈现我的应用程序 (http://example.com/user/beta),所以首先我的 index.html 被渲染 & index 包含我的 angular 2 东西,因为我使用的是 webpack一切都捆绑在 main、vendor 和 polyfill 中,我的结构是这样的:
app
|
|__angular
| |
| |
| |___src
| |___typings
| |___package.json, tsconfig.json, webpack.config.js
|
|
|__static
| |__css
| |__dist <this contains bundle files which got complied by webpack>
|
|
|__templates
| |
| |___index.html
| |___app
|__<all template files>
这里所有静态文件都存储到 CDN 并且似乎 js 文件正在被缓存,所以新的更改没有反映,以避免我必须手动对我的 js 文件进行版本控制,如 main.bundle.v.01.js,我想更改捆绑文件版本每次我想将它部署到测试/生产,所以这个手动工作消失了,为此我必须在 webpack.config 中做一些更改以进行版本控制并将它们放在 index.html 中,但由于 index.html 无法控制webpack 无法完成,所以我需要找到一种方法让 webpack 解析 Angular 应用程序代码,同时对这些捆绑文件进行版本控制并在 index.html 中替换它
【问题讨论】:
标签: javascript angularjs django angular webpack