1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 10:19:30 +02:00

Separated webpack entries from chunks so the big chunks can be cached easily.

This commit is contained in:
Gunther Brunner 2014-07-02 20:08:21 +09:00
parent 080d7d9e39
commit 0add3eaddc
6 changed files with 61 additions and 35 deletions

View file

@ -40,6 +40,9 @@ module.exports = function(options) {
app.use('/static/build', webpack({
debug: true
, devtool: 'eval'
, stats: {
colors: true
}
}))
}

View file

@ -1,3 +1,5 @@
require.ensure([], function (require) {
require('angular')
require('angular-route')
require('angular-touch')
@ -33,3 +35,6 @@ angular.module('app', [
.config(function (hotkeysProvider) {
hotkeysProvider.includeCheatSheet = false
})
})

View file

@ -23,5 +23,6 @@ html
div(ng-view).fill-height
script var APP = !{JSON.stringify(APP)}
script(src='/static/build/bundle.js')
script(src='/static/build/commons.entry.js')
script(src='/static/build/app.entry.js')
script(src='/static/bower_components/stf-analytics/analytics.js')

View file

@ -0,0 +1,5 @@
require.ensure([], function (require) {
require('angular')
require('angular-route')
})

View file

@ -0,0 +1,5 @@
require.ensure([], function (require) {
require('angular')
require('angular-route')
})

View file

@ -1,13 +1,19 @@
var pathutil = require('./lib/util/pathutil')
var webpack = require('webpack')
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin")
module.exports = {
cache: true
, entry: pathutil.resource('app/app.js')
, entry: {
app: pathutil.resource('app/app.js')
, authldap: pathutil.resource('auth-ldap/scripts/entry.js')
, authmock: pathutil.resource('auth-mock/scripts/entry.js')
}
, output: {
path: pathutil.resource('build')
, publicPath: '/static/build/'
, filename: 'bundle.js'
, filename: 'entry/[name].entry.js'
, chunkFilename: '[id].[hash].chunk.js'
}
, stats: {
colors: true
@ -78,5 +84,6 @@ module.exports = {
, ['main']
)
)
, new CommonsChunkPlugin("entry/commons.entry.js")
]
}