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({ app.use('/static/build', webpack({
debug: true debug: true
, devtool: 'eval' , devtool: 'eval'
, stats: {
colors: true
}
})) }))
} }

View file

@ -1,12 +1,14 @@
require('angular') require.ensure([], function (require) {
require('angular-route')
require('angular-touch')
require('angular-gettext') require('angular')
require('ng-file-upload') require('angular-route')
require('angular-hotkeys') require('angular-touch')
angular.module('app', [ require('angular-gettext')
require('ng-file-upload')
require('angular-hotkeys')
angular.module('app', [
'ngRoute', 'ngRoute',
'ngTouch', 'ngTouch',
'gettext', 'gettext',
@ -20,7 +22,7 @@ angular.module('app', [
require('./help').name, require('./help').name,
require('./../common/lang').name, require('./../common/lang').name,
require('./../test/samples/vs-repeat').name require('./../test/samples/vs-repeat').name
]) ])
.config(['$routeProvider', '$locationProvider', .config(['$routeProvider', '$locationProvider',
function ($routeProvider, $locationProvider) { function ($routeProvider, $locationProvider) {
$locationProvider.hashPrefix('!'); $locationProvider.hashPrefix('!');
@ -30,6 +32,9 @@ angular.module('app', [
}) })
} }
]) ])
.config(function(hotkeysProvider) { .config(function (hotkeysProvider) {
hotkeysProvider.includeCheatSheet = false hotkeysProvider.includeCheatSheet = false
}) })
})

View file

@ -23,5 +23,6 @@ html
div(ng-view).fill-height div(ng-view).fill-height
script var APP = !{JSON.stringify(APP)} 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') 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 pathutil = require('./lib/util/pathutil')
var webpack = require('webpack') var webpack = require('webpack')
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin")
module.exports = { module.exports = {
cache: true 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: { , output: {
path: pathutil.resource('build') path: pathutil.resource('build')
, publicPath: '/static/build/' , publicPath: '/static/build/'
, filename: 'bundle.js' , filename: 'entry/[name].entry.js'
, chunkFilename: '[id].[hash].chunk.js'
} }
, stats: { , stats: {
colors: true colors: true
@ -78,5 +84,6 @@ module.exports = {
, ['main'] , ['main']
) )
) )
, new CommonsChunkPlugin("entry/commons.entry.js")
] ]
} }