Git Product home page Git Product logo

Comments (9)

mrakobes27 avatar mrakobes27 commented on June 26, 2024

Hi! add the following settings to the config:
{ optimization: { usedExports: true, providedExports: true, } }
for enable tree-shaking

from rspack.

nguyenbatranvan avatar nguyenbatranvan commented on June 26, 2024

optimization: { usedExports: true, providedExports: true, }

image
Not working bro!!

from rspack.

nguyenbatranvan avatar nguyenbatranvan commented on June 26, 2024

any solutions for this?

from rspack.

JSerFeng avatar JSerFeng commented on June 26, 2024

I suppose the ./utils is your ./index.ts right ?

Here is my demo for you: https://github.com/JSerFeng/rspack-repro-treeshaking

If you have any questions, feel free to ask, it would be better if you can upload your reproduce demo

from rspack.

nguyenbatranvan avatar nguyenbatranvan commented on June 26, 2024

I suppose the ./utils is your ./index.ts right ?

Here is my demo for you: https://github.com/JSerFeng/rspack-repro-treeshaking

If you have any questions, feel free to ask, it would be better if you can upload your reproduce demo

why comment console.log(dayjs()), The problem I encountered was running that command line
image

from rspack.

JSerFeng avatar JSerFeng commented on June 26, 2024

You can uncomment this, the result is the same

The point is set utils.js as sideEffect free

from rspack.

ljianc avatar ljianc commented on June 26, 2024

官方文档的例子也不生效!设置成 minimize: true才生效。官网还特意设置成 minimize: false来演示,严重误导啊。应该改成minimize: true也生效吧?方便调试。@JSerFeng

from rspack.

JSerFeng avatar JSerFeng commented on June 26, 2024

官方文档的例子也不生效!设置成 minimize: true才生效。官网还特意设置成 minimize: false来演示,严重误导啊。应该改成minimize: true也生效吧?方便调试。@JSerFeng

官网例子可能有误导。你说的不生效可能是发现函数仍然存在于产物中,但其实那些未使用函数的引用已经没有了,这是符合预期的,webpack 去除掉的是未使用函数的导出,依赖 minimizer 去掉死代码。

from rspack.

ljianc avatar ljianc commented on June 26, 2024

官方文档的例子也不生效!设置成 minimize: true才生效。官网还特意设置成 minimize: false来演示,严重误导啊。应该改成minimize: true也生效吧?方便调试。@JSerFeng

官网例子可能有误导。你说的不生效可能是发现函数仍然存在于产物中,但其实那些未使用函数的引用已经没有了,这是符合预期的,webpack 去除掉的是未使用函数的导出,依赖 minimizer 去掉死代码。

对,官网确实误导。应该改一下文档,不能特意拿minimize: false来演示

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.