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