aws4-crypto
v1.0.0
Published
crypto drop in replacement for aws4 module based on sjcl
Downloads
1
Maintainers
Readme
aws4-crypto
crypto drop in replacement for aws4 module based on sjcl. the goal is to reduce the bundle size of aws4 package while used in browser.
install
npm install aws4-crypto --save
webpack usage
module.exports = {
...
resolve: {
...
alias: {
...
crypto: 'aws4-crypto',
...
}
...
},
...
}
Due to internal usage of sjcl, in order not to bundle crypto-browserify, add to config:
module.exports = {
...
module: {
noParse: /sjcl-aws/, // it requires crypto so webpack will bundle the browserified version. if the require fails it fallback to the browser api.
...
}
...
}
additional steps can be taken in order to reduce the aws4 package bundle size in browser
npm install url-lite --save
npm install null-loader --save-dev
add to webpack config:
module.exports = {
...
resolve: {
...
alias: {
...
url: 'url-lite' // aws4 uses url
...
}
...
},
module: {
...
rules: [
{
test: path.resolve(process.cwd(), 'node_modules/buffer/index.js'), // aws4 uses querystring-browser which requires it but it has no usage
use: [{
loader: 'null-loader'
}]
},
...
]
...
}
...
}
license
MIT