GithubHelp home page GithubHelp logo

Comments (7)

CPunisher avatar CPunisher commented on July 3, 2024 1

It's true that rspack document is not always up-to-date, which is a problem(I don't know how the team will improve this workflow in the future).

For now, we know rspack aims for alignment with webpack, so you may find some available configuration in webpack document such as https://webpack.js.org/configuration/optimization/#optimizationconcatenatemodules.

As for why it's not enabled by default in production mode, I guess this option was forgotten to be adjusted at the end of the experimental phase.

rspack:

D(optimization, "concatenateModules", false);

webpack: https://github.com/webpack/webpack/blob/8241da7f1e75c5581ba535d127fa66aeb9eb2ac8/lib/config/defaults.js#L1152
#6769

I'll make a simple pull request.

from rspack.

CPunisher avatar CPunisher commented on July 3, 2024

webpack/rspack generates runtime code for every small module. Maybe concatenateModules could help.

from rspack.

pastelsky avatar pastelsky commented on July 3, 2024

This build runs in production mode — so I assumed module concatenation would be on.

from rspack.

CPunisher avatar CPunisher commented on July 3, 2024

🤔 I manually set concatenateModules to true on top of your config and it did work.

  File                                        Size       Gzipped    
  rsbuild-dist/index.html                     0.32 kB    0.22 kB
  rsbuild-dist/static/js/index.3a9fa5b5.js    1.4 kB     0.74 kB
  rsbuild-dist/static/js/712.32ef6620.js      26.4 kB    8.0 kB

  Total size:  28.1 kB
  Gzipped size:  8.9 kB

from rspack.

pastelsky avatar pastelsky commented on July 3, 2024

Interesting, I don't see such an option documented here —
https://www.rspack.dev/config/optimization
Where is this documented?

Also, would you know why this isn't enabled by default?

from rspack.

hardfist avatar hardfist commented on July 3, 2024

@CPunisher concatenateModules is not enabled in production because we're still testing it, we will enable it by default in production when we think it's production ready

from rspack.

CPunisher avatar CPunisher commented on July 3, 2024

@hardfist 😄 That's what I'm going to ask. After I changed the default configuration, there are some test cases with strange errors.

from rspack.

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.