crypto drop in replacement for aws4 module based on sjcl
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.
``sh`
npm install aws4-crypto --save
`js`
module.exports = {
...
resolve: {
...
alias: {
...
crypto: 'aws4-crypto',
...
}
...
},
...
}
Due to internal usage of sjcl, in order not to bundle crypto-browserify, add to config:
`js`
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.
...
}
...
}
`sh`
npm install url-lite --save
npm install null-loader --save-dev
add to webpack config:
`js``
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'
}]
},
...
]
...
}
...
}
MIT