Skip to content

Commit

Permalink
fix(build): add setImmediate polyfill for web only
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Feb 24, 2024
1 parent 0cdb2f0 commit ad36776
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 10 deletions.
8 changes: 1 addition & 7 deletions bundle.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,7 @@ const bundle = () => {
target: ['esnext'],
format: 'esm',
globalName: 'ar.io',
plugins: [
polyfillNode({
polyfills: {
crypto: true,
},
}),
],
plugins: [polyfillNode()],
tsconfig: './tsconfig.web.json',
outfile: './bundles/web.bundle.min.js',
})
Expand Down
2 changes: 1 addition & 1 deletion examples/node/index.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { ArIO } = require('../../lib/cjs');
const { ArIO } = require('../../../lib/cjs/node/index.js');

(async () => {
const arIO = new ArIO({});
Expand Down
2 changes: 1 addition & 1 deletion examples/node/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArIO } from '../../lib/esm/index.js';
import { ArIO } from '../../lib/esm/node/index.js';

(async () => {
const arIO = new ArIO({});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"prettier": "^3.0.2",
"rimraf": "^5.0.1",
"semantic-release": "^21.0.7",
"setimmediate": "^1.0.5",
"sinon": "^15.2.0",
"ts-jest": "^29.1.2",
"ts-node": "^10.9.1",
Expand Down
2 changes: 2 additions & 0 deletions src/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// polyfill for setImmediate
import 'setimmediate';

export * from '../types/index.js';
export * from '../common/index.js';
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7610,7 +7610,7 @@ set-function-name@^2.0.1:
functions-have-names "^1.2.3"
has-property-descriptors "^1.0.0"

setimmediate@^1.0.4:
setimmediate@^1.0.4, setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==
Expand Down

0 comments on commit ad36776

Please sign in to comment.