Skip to content

Conversation

@ibrahimcesar
Copy link
Owner

No description provided.

…ncies

This commit fixes the "Cannot read properties of null (reading 'useState')" error
that occurred when using the library with Next.js.

Changes:
- Updated Vite config to explicitly set jsxRuntime: 'automatic' for proper JSX transformation
- Updated demo to use Next.js 15.5.6 (from 14.2.33) for better React 19 support
- Updated demo React to 19.0.0 (from 18.2.0) to match library peer dependencies
- Added .eslintrc.json to demo for Next.js 15 ESLint compatibility

The root cause was a combination of:
1. Implicit JSX runtime configuration in Vite
2. Outdated Next.js version with React version mismatch
3. Module resolution issues between the library build and Next.js runtime

The fix ensures:
- Proper React externalization in the library build
- Compatible versions across the demo stack
- Correct JSX transformation for library consumers

Tested with:
- npm run build (library): ✅ Successful
- npm run build (demo): ✅ Successful (3/3 pages generated)
- React hooks now properly resolve at runtime
Added comprehensive "Development Setup" section to explain:
- Repository structure (library root + demo/ folder)
- How the demo uses `file:..` to reference the local library
- Complete getting started guide for new contributors
- Step-by-step workflow for making and testing changes
- Important notes about the local development approach

This documentation helps contributors understand:
- Why demo uses `file:..` instead of the published npm version
- How to test library changes in the demo before publishing
- The rebuild workflow required when modifying library source

Related to the React hooks null error fix, this ensures contributors
know how to properly set up and test the local development environment.
Changes the demo application to use the published "react-lite-youtube-embed"
package instead of the local build, while documenting how contributors can
switch to local development mode when needed.

Changes:
- Updated demo/package.json to use "react-lite-youtube-embed": "*"
- Updated all imports from "@ibrahimcesar/react-lite-youtube-embed" to "react-lite-youtube-embed"
- Updated next.config.js transpilePackages to use new package name
- Rewrote CONTRIBUTING.md Development Setup section:
  - Demo uses published package by default (showcases what users install)
  - Added instructions for switching to local dev with "file:.." when testing changes
  - Emphasized reverting to published package before committing
  - Clearer workflow: getting started, running demo, local development, testing

Why this change:
- Demo showcases the actual package users will install from npm
- Contributors can still test locally by temporarily using "file:.."
- Ensures demo always represents the published user experience
- Reduces confusion about which version is being used

Local development workflow:
1. Change package.json to use "file:.." when testing library changes
2. Always revert to "react-lite-youtube-embed": "*" before committing
…cgbutfvbqgtfb8

Resolved conflict in CONTRIBUTING.md by combining both approaches:
- Maintains demo using published package by default (react-lite-youtube-embed: "*")
- Incorporates useful additions from main branch:
  * Watch mode for faster development iteration
  * Comprehensive troubleshooting section
  * CSS modification workflow
  * Type checking and formatting commands
  * "npm run ci" for running all checks at once
- Clear instructions for switching to local development with file:..
- Strong reminder to revert to published package before committing

Also brings in from main:
- Version bump to 3.2.0
- vite-plugin-dts upgrade to 4.5.4
- TypeScript version warning suppression in rollup options
@github-actions
Copy link
Contributor

size-limit report 📦

Path Size
ES Module 2.99 KB (0%)
CommonJS 2.96 KB (0%)
CSS 1.05 KB (0%)

@ibrahimcesar ibrahimcesar merged commit 0cc9ade into main Nov 15, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants