Code Monkey home page Code Monkey logo

Comments (11)

thoughtspile avatar thoughtspile commented on August 26, 2024 1

Thanks @okikio, works much better now! I'm seeing some other suspicious behavior, let me open another issue

from bundlejs.

okikio avatar okikio commented on August 26, 2024 1

Ok

from bundlejs.

okikio avatar okikio commented on August 26, 2024

@thoughtspile Sorry, for the delay, but after a through analysis of the bundl, a deconstruction and re-write of the virtual filesystem of bundlejs, it seems it keeps trying to bundle in the parser, and I can't quite figure out why.

It doesn't really make any sense as to why it keeps trying to bundle the parser, this might be an esbuild-wasm bug of some sort, it's super inconsistent, and due to the lack of an AST it's really difficult to debug where it's messing up

from bundlejs.

okikio avatar okikio commented on August 26, 2024

After a couple more experiments it seems for treeshaking to work in an ideal way it needs to have all the files it needs to traverse up front, the problem is that is double the build time versus just bundling it once.

I've setup a seperate branch with the treeshaking exeriments https://bundle-git-treeshaking-fix-okikio-dev.vercel.app/?q=date-fns&treeshake=%5B%7B+isAfter+%7D%5D&config=%7B%22esbuild%22%3A%7B%22minify%22%3Afalse%7D%7D

from bundlejs.

okikio avatar okikio commented on August 26, 2024

Good news, I seem to have a permanent solution to the problem of poor treeshaking.
It seems this issue is caused by esbuild being unable to determine if it should include sideEffects or not.

On a local file system esbuild can easily just look up the package.json files but it can't quite do that when using a virtual fs, so the solution is to just let esbuild know to use sideEffects if it's stated in the package.json file

from bundlejs.

thoughtspile avatar thoughtspile commented on August 26, 2024

Hi again my friend @okikio! Got a chance to roll out the fix? Still seeing odd sizes in badges:

Снимок экрана 2023-07-02 в 20 38 25

from bundlejs.

okikio avatar okikio commented on August 26, 2024

I was able to fix it, I just hadn't found a chance to publish it. This weekend is a little hectic, I should be able to get the fix out by Tuesday or Wednesday this week

from bundlejs.

okikio avatar okikio commented on August 26, 2024

The API hasn't been fixed yet, but here is the newly improved treeshaking
CleanShot 2023-07-02 at 21 44 08@2x

from bundlejs.

okikio avatar okikio commented on August 26, 2024

The API is now fixed as well. Treeshaking should now work properly across the website and API. I'll keep this issue open, please let me know if you notice any issues
https://bundlejs.com/?q=date-fns&treeshake=%5B%7B+isAfter+%7D%5D&bundle

CleanShot 2023-07-03 at 00 15 37@2x

from bundlejs.

okikio avatar okikio commented on August 26, 2024

@thoughtspile Does the fix work for you?

from bundlejs.

okikio avatar okikio commented on August 26, 2024

Since the fix seems to work ill close this issue

from bundlejs.

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.