Next.js app router support - #246
Conversation
36719f0 to
5070047
Compare
yiotaz
left a comment
There was a problem hiding this comment.
Everything looks good!
Suggestion, non blocking for release: We could add a build test to assert that dist/index.js and dist/index.modern.js start with 'use client';. Right now, test:build only checks that the build succeeds — if the post-build step is removed or dist output changes, CI would still pass while Next.js consumers hit the Client Component import error again.
I initially felt this might be over-testing, but it's actually a meaningful guard rather than a redundant one. Unlike the bundled components/hooks — which the bundler guarantees and the unit tests already exercise against |
NOTE: It's possible to add 'use client' manually in the source files, but when 'use client' was added to src/index.js, microbundle printed:
Module level directives cause errors when bundled, 'use client' was ignored.Rollup/microbundle strips module-level directives when it bundles everything into a single dist/index.js. So putting it in source alone would not reach npm consumers. The script is mandatory for the current microbundle single-bundle setup, unless you change the build to inject or preserve the directive another way.