Commit 4b007a6
authored
Avoid dynamic require of the native package (#200)
Fixes libsql with `next build --turbopack`:
vercel/next.js#82881 (comment)
When combined with a non-isolating hoisting package manager (e.g. pnpm
avoids this problem), these requires are written in a way that bundlers
may be forced to pull in extra packages and files that are also under
the `@libsql/` namespace. Even if this doesn't cause issues with certain
tooling, it's playing with fire.
This could be written in a more clever way, but this writes it in the
simplest-to-analyze possible way that should work with all bundlers.
There's no real standard for what is or isn't statically analyzable by a
bundler.
**This is a PR for the `v0.5` branch.**
**v0.6.x does not appear to have this problem,** as it's written in a
similar way to this, where there are simple `require()` expressions with
static strings.1 file changed
Lines changed: 27 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
27 | 53 | | |
28 | 54 | | |
29 | 55 | | |
| |||
0 commit comments