SyntaxError in node's strict mode (--use_stict)
Trying to require library in strict mode of node (node --use_strict) causes a SyntaxError:
let forge = require('node-forge');
SyntaxError: Delete of an unqualified identifier in strict mode.
The error is caused by the following line in file /js/forge.js:
delete define;
AFAIK, in strict it's prohibited to delete global variables (properties of global object) this way. Please fix this behaviour in order to make the library work in strict mode.
This is related to item 6 of the roadmap: #203
We need to update the packaging system for forge, removing handcrafted boilerplate and replacing it with something that is auto-generated and that supports a variety of different package/module loading APIs/mechanisms.
+1 Any temporary solution for this issue?
Personally I have ended up rewriting my files to have 'use strict'; in the beginning, and now I'm running node without --use_strict flag. This way everything is working like a charm.
I'm using webpack to build my js file which means 'use strict' will included in my bundle file. In the end I have to do plain copy forge.min.js without compile it into my bundle js
My pull request that removes RequireJS and uses Webpack instead also runs all non-browser tests with strict mode without problems: https://github.com/digitalbazaar/forge/pull/357
+1
Any permanent fix coming to this?
Any permanent fix coming to this?
cc: @davidlehn -- can we get a synopsis of the remaining challenges over at #357? There's also an offer of assistance over there.
+1
+1
Should be addressed in a new release now that #456 has been merged.