Fix bcrypt issues for browserify
This commit is contained in:
parent
bb2632a5fc
commit
cb2f40bb86
|
@ -70,7 +70,7 @@ module.exports = function(grunt) {
|
||||||
'dist/loopback.js': ['index.js'],
|
'dist/loopback.js': ['index.js'],
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
ignore: ['nodemailer', 'passport'],
|
ignore: ['nodemailer', 'passport', 'bcrypt'],
|
||||||
standalone: 'loopback'
|
standalone: 'loopback'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,8 @@ module.exports = function(grunt) {
|
||||||
'passport',
|
'passport',
|
||||||
'passport-local',
|
'passport-local',
|
||||||
'superagent',
|
'superagent',
|
||||||
'supertest'
|
'supertest',
|
||||||
|
'bcrypt'
|
||||||
],
|
],
|
||||||
// transform: ['coffeeify'],
|
// transform: ['coffeeify'],
|
||||||
// debug: true,
|
// debug: true,
|
||||||
|
|
|
@ -11,6 +11,10 @@ var bcrypt;
|
||||||
try {
|
try {
|
||||||
// Try the native module first
|
// Try the native module first
|
||||||
bcrypt = require('bcrypt');
|
bcrypt = require('bcrypt');
|
||||||
|
// Browserify returns an empty object
|
||||||
|
if (bcrypt && typeof bcrypt.compare !== 'function') {
|
||||||
|
bcrypt = require('bcryptjs');
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Fall back to pure JS impl
|
// Fall back to pure JS impl
|
||||||
bcrypt = require('bcryptjs');
|
bcrypt = require('bcryptjs');
|
||||||
|
|
|
@ -94,7 +94,8 @@
|
||||||
"express": "./lib/browser-express.js",
|
"express": "./lib/browser-express.js",
|
||||||
"./lib/server-app.js": "./lib/browser-express.js",
|
"./lib/server-app.js": "./lib/browser-express.js",
|
||||||
"connect": false,
|
"connect": false,
|
||||||
"nodemailer": false
|
"nodemailer": false,
|
||||||
|
"bcrypt": false
|
||||||
},
|
},
|
||||||
"license": {
|
"license": {
|
||||||
"name": "Dual MIT/StrongLoop",
|
"name": "Dual MIT/StrongLoop",
|
||||||
|
|
Loading…
Reference in New Issue