Giter VIP home page Giter VIP logo

Comments (8)

developit avatar developit commented on May 11, 2024

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.

piuccio avatar piuccio commented on May 11, 2024

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.

developit avatar developit commented on May 11, 2024

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.

piuccio avatar piuccio commented on May 11, 2024

@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.

developit avatar developit commented on May 11, 2024

@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.

piuccio avatar piuccio commented on May 11, 2024

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.

developit avatar developit commented on May 11, 2024

@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.

developit avatar developit commented on May 11, 2024

I think we can close this out since we ship an ES bundle now.

from preact-compat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.