virtualstate / navigation

Native JavaScript navigation [web api] implementation
MIT License
77 stars 5 forks source link

Safari doesn't work when using the default export and only works when using the rollup export #25

Open lucsoft opened 6 months ago

lucsoft commented 6 months ago

Prerequisites

Version (i.e. v2.x.x)

1.0.1-alpha.199

Node.js version (i.e. 18.x, or N/A)

v21.5.0

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10, or N/A)

14.3

Description

Im bundling this polyfill via webpack.

Problem i found using @virtualstate/navigation/polyfill/rollup as an entrypoint and importing that works under Safari But @virtualstate/navigation/polyfill doesn not.

This only effects Safari after a reload (When its using its Cache, disabling the Cache works)

Steps to Reproduce

(coming soon)

Expected Behavior

No response

fabiancook commented 6 months ago

Since you're using webpack, I would imagine it would be leaning towards needing a commonjs compatible module, which /polyfill/rollup is.

I've added the mapping for commonjs for just /polyfill to automatically pick between esm and cjs, let me know if this does the trick. Version 1.0.1-alpha.200 is publishing now with this change.

Let me know if this does the trick or not.