RSAForPostman
RSAForPostman copied to clipboard
"ReferenceError: window is not defined " in Postman
Hi, I am follow all the steps and try to use RSA encryption in postman but getting error "ReferenceError: window is not defined". Please help me to fix this issues.
@VipinMishra did you build yourself or just use my existing script. If you build yourself remember modify umd to var as my description. Or you can download my existing forge.js and try again
Hello I used the file you provided, but I still encountered the same problem. this tip is also: ReferenceError: window is not defined Can you help me?
Thanks
I was having the same issue. Here's my solution:
- clone the forge repo
https://github.com/digitalbazaar/forge.git - add the package global to the cloned forge project
npm i global --save-dev - update the
webpack.config.js, replacing'umd'with'var'as @loveiset has done and update thepluginsto addglobal/window:
const bundle = Object.assign({}, common, {
mode: 'development',
output: {
path: path.join(__dirname, 'dist'),
filename: info.filenameBase + '.js',
library: info.library || '[name]',
libraryTarget: info.libraryTarget || 'var'
},
plugins: [
new webpack.ProvidePlugin({
window: 'global/window',
}),
]
});
if (info.library === null) {
delete bundle.output.library;
}
if (info.libraryTarget === null) {
delete bundle.output.libraryTarget;
}
// optimized and minified bundle
const minify = Object.assign({}, common, {
mode: 'production',
output: {
path: path.join(__dirname, 'dist'),
filename: info.filenameBase + '.min.js',
library: info.library || '[name]',
libraryTarget: info.libraryTarget || 'var'
},
devtool: 'cheap-module-source-map',
plugins: [
new webpack.ProvidePlugin({
window: 'global/window',
}),
]
});
- build the project
npm run build. copydist/forge.jsto Postman
Hope that helps!