Commit 968f14b
committed
fix: move browser to top of exports
The order of exports is important. If you want to serve a browser-specific
file, it needs to go earlier in the exports object, otherwise one
of the other exports will be matched.
In this case the file being webpacked was using require, which matched
`exports.require` before `exports.browser` so tried to require
`./src/lib.cjs`, which then throws as it tries to require `util` which
is not a dep of this module.
The solution is just to move the `browser` field in front of `require`
and `import`.1 parent 52d7006 commit 968f14b
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | | - | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
0 commit comments