webpack: use -browser convention instead of aliases.
This commit is contained in:
parent
3763b5309a
commit
24cd81a1bd
@ -18,4 +18,4 @@ if (+process.env.BCOIN_USE_ELLIPTIC !== 1) {
|
|||||||
|
|
||||||
module.exports = native
|
module.exports = native
|
||||||
? require('./secp256k1-native')
|
? require('./secp256k1-native')
|
||||||
: require('./secp256k1-elliptic');
|
: require('./secp256k1-browser');
|
||||||
|
|||||||
2
lib/http/base-browser.js
Normal file
2
lib/http/base-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/http/client-browser.js
Normal file
2
lib/http/client-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/http/request-browser.js
Normal file
2
lib/http/request-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/http/rpcclient-browser.js
Normal file
2
lib/http/rpcclient-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/http/server-browser.js
Normal file
2
lib/http/server-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/http/wallet-browser.js
Normal file
2
lib/http/wallet-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
1
lib/native-browser.js
Normal file
1
lib/native-browser.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
exports.binding = null;
|
||||||
2
lib/net/socks-browser.js
Normal file
2
lib/net/socks-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/utils/fs-browser.js
Normal file
2
lib/utils/fs-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/wallet/client-browser.js
Normal file
2
lib/wallet/client-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/wallet/http-browser.js
Normal file
2
lib/wallet/http-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/wallet/server-browser.js
Normal file
2
lib/wallet/server-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
2
lib/workers/cp-browser.js
Normal file
2
lib/workers/cp-browser.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
// Empty module for browserify.
|
||||||
|
exports.unsupported = true;
|
||||||
3
lib/workers/cp.js
Normal file
3
lib/workers/cp.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = require('child_process');
|
||||||
@ -10,7 +10,7 @@
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var EventEmitter = require('events').EventEmitter;
|
var EventEmitter = require('events').EventEmitter;
|
||||||
var os = require('os');
|
var os = require('os');
|
||||||
var cp = require('child_process');
|
var cp = require('./cp');
|
||||||
var util = require('../utils/util');
|
var util = require('../utils/util');
|
||||||
var co = require('../utils/co');
|
var co = require('../utils/co');
|
||||||
var Network = require('../protocol/network');
|
var Network = require('../protocol/network');
|
||||||
|
|||||||
39
package.json
39
package.json
@ -65,44 +65,5 @@
|
|||||||
"test-browser": "BCOIN_NO_NATIVE=1 BCOIN_USE_ELLIPTIC=1 mocha --reporter spec test/*-test.js",
|
"test-browser": "BCOIN_NO_NATIVE=1 BCOIN_USE_ELLIPTIC=1 mocha --reporter spec test/*-test.js",
|
||||||
"test-file": "mocha --reporter spec",
|
"test-file": "mocha --reporter spec",
|
||||||
"webpack": "webpack"
|
"webpack": "webpack"
|
||||||
},
|
|
||||||
"browser": {
|
|
||||||
"child_process": "./browser/empty.js",
|
|
||||||
"crypto": "./browser/empty.js",
|
|
||||||
"dgram": "./browser/empty.js",
|
|
||||||
"dns": "./browser/empty.js",
|
|
||||||
"fs": "./browser/empty.js",
|
|
||||||
"net": "./browser/empty.js",
|
|
||||||
"bcoin-native": "./browser/empty.js",
|
|
||||||
"secp256k1": "./browser/empty.js",
|
|
||||||
"socket.io": "./browser/empty.js",
|
|
||||||
"./lib/bcoin": "./lib/bcoin-browser.js",
|
|
||||||
"./lib/blockchain/layout.js": "./lib/blockchain/layout-browser.js",
|
|
||||||
"./lib/crypto/aes.js": "./lib/crypto/aes-browser.js",
|
|
||||||
"./lib/crypto/digest.js": "./lib/crypto/digest-browser.js",
|
|
||||||
"./lib/crypto/pbkdf2.js": "./lib/crypto/pbkdf2-browser.js",
|
|
||||||
"./lib/crypto/random.js": "./lib/crypto/random-browser.js",
|
|
||||||
"./lib/crypto/rsa.js": "./lib/crypto/rsa-browser.js",
|
|
||||||
"./lib/crypto/secp256k1.js": "./lib/crypto/secp256k1-elliptic.js",
|
|
||||||
"./lib/db/backends.js": "./lib/db/backends-browser.js",
|
|
||||||
"./lib/hd/wordlist": "./lib/hd/wordlist-browser.js",
|
|
||||||
"./lib/http/base": "./browser/empty.js",
|
|
||||||
"./lib/http/client": "./browser/empty.js",
|
|
||||||
"./lib/http/request": "./browser/empty.js",
|
|
||||||
"./lib/http/rpcclient": "./browser/empty.js",
|
|
||||||
"./lib/http/server": "./browser/empty.js",
|
|
||||||
"./lib/http/wallet": "./browser/empty.js",
|
|
||||||
"./lib/mempool/layout": "./lib/mempool/layout-browser.js",
|
|
||||||
"./lib/native": "./browser/empty.js",
|
|
||||||
"./lib/net/dns": "./lib/net/dns-browser.js",
|
|
||||||
"./lib/net/external": "./lib/net/external-browser.js",
|
|
||||||
"./lib/net/socks": "./browser/empty.js",
|
|
||||||
"./lib/net/tcp": "./lib/net/tcp-browser.js",
|
|
||||||
"./lib/net/upnp": "./lib/net/upnp-browser.js",
|
|
||||||
"./lib/utils/fs": "./browser/empty.js",
|
|
||||||
"./lib/utils/nfkd": "./lib/utils/nfkd-browser.js",
|
|
||||||
"./lib/wallet/http": "./browser/empty.js",
|
|
||||||
"./lib/wallet/layout": "./lib/wallet/layout-browser.js",
|
|
||||||
"./lib/wallet/server": "./browser/empty.js"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@ module.exports = {
|
|||||||
resolve: {
|
resolve: {
|
||||||
descriptionFiles: ['package.json'],
|
descriptionFiles: ['package.json'],
|
||||||
modules: ['node_modules'],
|
modules: ['node_modules'],
|
||||||
extensions: ['.js', '.json'],
|
extensions: ['-browser.js', '.js', '.json'],
|
||||||
aliasFields: ['browser']
|
aliasFields: ['browser']
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user