Move build to webpack

This commit is contained in:
Mitra Ardron 2018-04-26 12:53:42 +10:00
parent abcc02bf0b
commit 37e9d9507f
2 changed files with 29 additions and 3 deletions

View File

@ -41,10 +41,9 @@
"url": "git://github.com/internetarchive/dweb-transports.git"
},
"scripts": {
"build": "browserify ./index.js > ./dist/dweb-transports-bundle.js",
"watch": "watchify ./index.js -o dist/dweb-transports-bundle.js --verbose",
"build": "webpack --mode development",
"test": "cd src; node ./test.js",
"help": "echo 'test (test it)'; echo 'bundle (packs into ../examples)'; echo 'watch: continually bundles whenever files change'"
"help": "echo 'test (test it)'; echo 'build (creates dweb-transports-bundle)'"
},
"version": "0.0.1"
}

27
webpack.config.js Normal file
View File

@ -0,0 +1,27 @@
module.exports = {
entry: {
'dweb-transports': './index.js',
},
output: {
filename: '[name]-bundle.js',
path: __dirname + '/dist'
},
node: {
fs: 'empty',
net: 'empty',
tls: 'empty',
crypto: 'empty',
process: true,
module: false,
clearImmediate: false,
Buffer: true,
setImmediate: false,
console: false
},
resolve: {
alias: {
zlib: 'browserify-zlib-next'
}
}
}