Comments (8)
Hmm - I should think it's at least mildly severable. I wonder - do you think the default export being an Object like that is causing everything to be referenced?
from preact-compat.
Yeah, I reckon it's the default object, but I haven't tried to get rid of that.
In that case another, simpler, approach is to have one file exporting only named functions and then index.js importing from it and exporting again named and default export. That way I can use rollup-plugin-alias to point to the first file letting rollup tree-shake correctly.
I'll let you know tomorrow
from preact-compat.
I've been doing that as well, but then people complained that they couldn't do this when using ES Modules via jsnext:main
:
import React from 'preact-compat';
Not sure which way to go. Personally I dislike exporting an identical object as default
, it seems a bit odd.
from preact-compat.
@developit #212 suggests a way to keep compatibility and allow tree shaking. Would be great to see if you or anyone else get similar results in terms of bytes saved.
from preact-compat.
@piuccio Curious if you're still wanting to make changes here. I know you were able to shake quite a bit out of preact and preact-compat - does that mean you were able to work around it?
from preact-compat.
Hi, organising the code differently would still allow to save extra bytes, but I'm not obsessed by it anymore. After all preact is not very big to start with.
Do what's more comfortable for you in terms of maintenability, code reading and things like that. I wouldn't be upset if this gets closed and the code stays as it is
from preact-compat.
@piuccio Alrighty. For what it's worth, I'm working on removing as many couplings as possible - previously, Component
couldn't be removed because there were type checks that needed a reference to it. Dropping Component means dropping Component.linkState()
and a few other things, which might save 500b.
from preact-compat.
I think we can close this out since we ship an ES bundle now.
from preact-compat.
Related Issues (20)
- Numeric size attributes should be correctly normalized HOT 1
- Uncaught (in promise) TypeError: Cannot assign to read only property 'nodeName' of object '#<HTMLInputElement> HOT 3
- babel-core may be outdated HOT 1
- 3.19.0 appears to break server-side rendering by relying on window HOT 2
- preact-compat for third-party package HOT 3
- Can't resolve 'react' HOT 2
- Example "without bundler" up to date? HOT 1
- [Material-UI] Select broken - modifying event target HOT 4
- preact-compat crashes when trying to migrate react functions + hooks to preact HOT 3
- SVG `clipPath` properties should be rendered as `clip-path` attributes in the DOM. HOT 1
- [BUG] Uncontrolled input acts as controlled (issue on defaultValue) HOT 1
- Uncaught ReferenceError: h is not defined HOT 1
- npm alias HOT 1
- README "without webpack" suggested usage doesn't work HOT 1
- Not work with AntD HOT 1
- Does latest preact-compat works with preact@10?
- Warnings incorrect peer dependency HOT 2
- Preact-compat + htm without bundler? HOT 1
- Using without webpack HOT 2
- ATTENTION: preact-compat moved to the main repo
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 preact-compat.