Open davidmurdoch opened 8 months ago
@naugtur has reported this as well. I’m open to adding an entry to package.json
"exports"
for the existing minified dist
. I would want to also test it in the top-level browser-test
CI job, because as you point out, the minifier can break invariants and we are not currently testing the minified version. We also have not audited terser
to ensure it maintains our invariants, so there are some implicit risks of adopting the version we distribute.
Describe the bug
ses
package includes minified versions of the libraries, but these are impossible to import/require in Node.js, as it only allows importing files defined in thepackage.json
exports
fields. Bundlers that use/follow Node's resolution algorithm are also unable to import the file.Steps to reproduce
Via Node
npm init -y && npm install ses
Run
node lockdown.js
.Output:
Via Bundler (Webpack)
Run
npx -y webpack
.output:
Expected behavior
Users should be able to require/import the pre-minified JavaScript. While bundlers can minimize the export for lockdown that is defined in
ses
'spackage.json
, I worry that aggressive minification/optimizations could alter the behavior in subtle ways that may render lockdown ineffective. Maybe this isn't a valid concern, and if not, I'd love for someone from the team to assuage my fears (note: I'm not worried about a supply chain attack compromising ses in this case)!Platform environment
webpack@5 ses@1.4.0