In #152 we stopped bundling all dependencies in the package. As it turns out, bundling was ensuring an all-CJS format and it was incorporating not only external deps but relative files. By removing bundling and not explicitly marking the format as CJS we inadvertently introduced ESM syntax and omitted relative files. More info here.
When the platform is set to node:
When bundling is enabled the default output format is set to cjs, which stands for CommonJS (the module format used by node). ES6-style exports using export statements will be converted into getters on the CommonJS exports object.
This package doesn't support ESM yet (at least not intentionally), so this PR:
Explicitly sets the format to CJS
Explicitly sets the two inputs to work with
Testing
You can test that this fix works by first cloning and setting up this repo:
git clone git@github.com:jodyheavener/tmp-opjs-test.git
cd ./tmp-opjs-test
yarn && yarn start
This test repo has the op-js codebase symlinked as a dependency, so if you've built it locally everything should be working as expected. By comparison, if you were to repeat these steps in the op-js repo on main, it should fail.
Fixes https://github.com/1Password/op-js/issues/153
In #152 we stopped bundling all dependencies in the package. As it turns out, bundling was ensuring an all-CJS format and it was incorporating not only external deps but relative files. By removing bundling and not explicitly marking the format as CJS we inadvertently introduced ESM syntax and omitted relative files. More info here.
This package doesn't support ESM yet (at least not intentionally), so this PR:
Testing
You can test that this fix works by first cloning and setting up this repo:
Then you can also clone this test repo I set up:
This test repo has the
op-js
codebase symlinked as a dependency, so if you've built it locally everything should be working as expected. By comparison, if you were to repeat these steps in theop-js
repo onmain
, it should fail.