mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 22:53:26 +02:00
Starting to add WebPack support.
This commit is contained in:
@@ -17,6 +17,9 @@ var wireutil = require('../wire/util')
|
||||
var wirerouter = require('../wire/router')
|
||||
var dbapi = require('../db/api')
|
||||
|
||||
var webpackMiddleware = require("webpack-dev-middleware")
|
||||
var webpack = require("webpack")
|
||||
|
||||
var auth = require('../middleware/auth')
|
||||
|
||||
module.exports = function(options) {
|
||||
@@ -38,6 +41,34 @@ module.exports = function(options) {
|
||||
app.use('/static/lib', express.static(pathutil.resource('lib')))
|
||||
app.use('/static', express.static(pathutil.resource('app')))
|
||||
|
||||
// WebPack settings
|
||||
app.use(webpackMiddleware(webpack( {
|
||||
cache: true,
|
||||
debug: true,
|
||||
devtool: 'inline-source-map',
|
||||
entry: pathutil.resource('app') + '/scripts/entry.js',
|
||||
output: {
|
||||
path: '/static/build/',
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
resolve: {
|
||||
modulesDirectories: [pathutil.resource('lib'), './../../node_modules']
|
||||
},
|
||||
loaders: [
|
||||
{ test: /\.css$/, loader: 'style!css' },
|
||||
{ test: /\.coffee$/, loader: 'coffee' }
|
||||
]
|
||||
}), {
|
||||
noInfo: false,
|
||||
quiet: false,
|
||||
lazy: false,
|
||||
publicPath: '/static/build/',
|
||||
// public path to bind the middleware to use the same as in webpack
|
||||
stats: {
|
||||
colors: true
|
||||
}
|
||||
}))
|
||||
|
||||
app.use(express.cookieParser(options.secret))
|
||||
app.use(express.cookieSession({
|
||||
key: options.ssid
|
||||
|
||||
Reference in New Issue
Block a user