Exclude express-middleware from browser bundle
Fix lib/loopback to include express-middleware only on the server. Bump up strong-remoting dependency to use the version working in browsers.
This commit is contained in:
parent
663e2d1903
commit
88a4bb462e
|
@ -1,7 +1,7 @@
|
|||
var express = require('express');
|
||||
var path = require('path');
|
||||
|
||||
var middlewares = express.middlewares = {};
|
||||
var middlewares = exports;
|
||||
|
||||
function safeRequire(m) {
|
||||
try {
|
||||
|
@ -50,7 +50,3 @@ middlewares.favicon = function (icon, options) {
|
|||
icon = icon || path.join(__dirname, '../favicon.ico');
|
||||
return favicon(icon, options);
|
||||
};
|
||||
|
||||
module.exports = express;
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var express = require('./express-middleware')
|
||||
var express = require('express')
|
||||
, fs = require('fs')
|
||||
, ejs = require('ejs')
|
||||
, path = require('path')
|
||||
|
@ -89,8 +89,7 @@ function createApplication() {
|
|||
}
|
||||
|
||||
/*!
|
||||
* Expose express.middleware as loopback.*
|
||||
* for example `loopback.errorHandler` etc.
|
||||
* Expose static express methods like `express.errorHandler`.
|
||||
*/
|
||||
|
||||
for (var key in express) {
|
||||
|
@ -100,11 +99,22 @@ for (var key in express) {
|
|||
, Object.getOwnPropertyDescriptor(express, key));
|
||||
}
|
||||
|
||||
for (var key in express.middlewares) {
|
||||
/*!
|
||||
* Expose additional middleware like session as loopback.*
|
||||
* This will keep the loopback API compatible with express 3.x
|
||||
*
|
||||
* ***only in node***
|
||||
*/
|
||||
|
||||
if (loopback.isServer) {
|
||||
var middlewares = require('./express-middleware');
|
||||
|
||||
for (var key in middlewares) {
|
||||
Object.defineProperty(
|
||||
loopback
|
||||
, key
|
||||
, Object.getOwnPropertyDescriptor(express.middlewares, key));
|
||||
, Object.getOwnPropertyDescriptor(middlewares, key));
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
"debug": "~0.8.1",
|
||||
"express": "4.x",
|
||||
"body-parser": "~1.2.2",
|
||||
"strong-remoting": "2.0.0-beta2",
|
||||
"strong-remoting": "2.0.0-beta3",
|
||||
"inflection": "~1.3.5",
|
||||
"passport": "~0.2.0",
|
||||
"passport-local": "~1.0.0",
|
||||
|
|
Loading…
Reference in New Issue