Giter Site home page Giter Site logo

Comments (7)

thoughtspile avatar thoughtspile commented on June 12, 2024

Actually, sourcemap: true correctly computes renderedLength, but later it's dismissed in ModuleLengths.

This computation can be better adjusted for unicode by this change in getBytesPerFileUsingSourceMap:

- modules[id].renderedLength += 1;
+ modules[id].renderedLength +=  Buffer.byteLength(code[i], "utf-8");`

Ran additional tests on date-fns/locale (a lot of unicode), here are the results:

  1. Actual bundle size: 597kB
  2. Reported: 990kB (166% actual), regardless of sourcemap option.
  3. Reported using rollup's renderedLength and sourcemap: false: 915kB (153% actual)
  4. Reported using renderedLength from current sourcemap: true: 521kB (87% actual)
  5. Reported using renderedLength with unicode-adjusted sourcemap: 597kB (matches actual)

How would you feel about using renderedLength when sourcemap option is enabled, and adding unicode adjustment I propose?

from rollup-plugin-visualizer.

btd avatar btd commented on June 12, 2024

Hi. First of all Thanks for every detailed issue.
Yes reportered size always different from actual one. Closest you can get to reality with sourcemap option set to true.
I should say i never tried to use non ascii chracters.
It would be nice if you will make PR and i will take a look. Otherwise no ETA.
Also i am curious if we should use codePointAt or anything that correctly traverse code points. Random index could point in the middle of surrogate pair

from rollup-plugin-visualizer.

btd avatar btd commented on June 12, 2024

I have published 5.9.2. Take a look pls if it improves size reporting with sourcemap.

from rollup-plugin-visualizer.

r-thomson avatar r-thomson commented on June 12, 2024

I have published 5.9.2. Take a look pls if it improves size reporting with sourcemap.

Heads up, 5.9.2 seems to be missing from the changelog

from rollup-plugin-visualizer.

jasonaden avatar jasonaden commented on June 12, 2024

I have published 5.9.2. Take a look pls if it improves size reporting with sourcemap.

Heads up, 5.9.2 seems to be missing from the changelog

I think it was supposed to say 5.9.1 since that was published 4 days ago and sounds like it matches this issue.

from rollup-plugin-visualizer.

r-thomson avatar r-thomson commented on June 12, 2024

Heads up, 5.9.2 seems to be missing from the changelog

I think it was supposed to say 5.9.1 since that was published 4 days ago and sounds like it matches this issue.

Except there was a 5.9.2 published

from rollup-plugin-visualizer.

btd avatar btd commented on June 12, 2024

The difference between 5.9.2 and 5.9.1 is that i dropped 14.x from test matrix

from rollup-plugin-visualizer.

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.