Comments (4)
Thanks @jrson83! I've done some more research and this seems logical to me. Thanks for having taken a look into it!
from vite-component-library-template.
@IgnacioNMiranda great, if you experience any problems, please let me know.
from vite-component-library-template.
@jrson83 Hey! thanks for opening this and for demonstrating interest in the repo!
Could you explain a bit more why this is not needed in the bundle? Please attach any url, blog post, or news that explain it, as I was not able to find any 🙂🙏🏻
from vite-component-library-template.
@IgnacioNMiranda as I was looking for examples, how to properly bundle a react component library I found this repo. Since I was wondering, why my setup was including the jsx-runtime
, I checked the dist output of your repo and it was also including the runtime.
The library package has specified react & react-dom as peerDependencies
, which includes the JSX runtime. As I understand, a library bundle is meant to be consumed by another project which needs react installed as dependencies
, so it solves the required peerDependencies
. When the library component is consumed by the project, it receives/uses the JSX runtime from the projects dependencies
. That's why there is no need to include the runtime in the component library.
"peerDependencies": {
"react": "18.2.0",
"react-dom": "18.2.0"
},
I found this related issue, explaining that the cause is that vite is using the automatic JSX runtime (not classic). And this stackoverflow thread, providing the same information and fix.
I added the fix, run build
, then pnpm pack
in the vite-component-library-template
root and installed the package as local dependency inside another react project. I used import { AtButton } from 'vite-component-library-template'
and run dev/build
without any problems.
from vite-component-library-template.
Related Issues (11)
- Typescript support HOT 2
- Why do we need 2 vite config HOT 2
- I think we should use more eslint plugins HOT 1
- Cannot read properties of null (reading 'useState') HOT 4
- restore package.json in postpack HOT 2
- Publishing this to GitHub packages instead. HOT 1
- Not able to see example AtButton with proper styles using npm pack HOT 2
- Component Styles Not Applied Upon Import HOT 1
- Add ES modules (ESM) support HOT 2
- How to Publish as CDN?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-component-library-template.