Webpack 压缩路径名 [英] Webpack compress path names

查看:36
本文介绍了Webpack 压缩路径名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

他们是一个 webpack 插件,可以将输出字符串路径更改为更短的路径而不发生冲突,即 ./node_modules/module_a -> ./n/a.

Is their a webpack plugin that can change the output string paths to be shorter paths without clashing i.e. ./node_modules/module_a -> ./n/a.

在已经缩小的输出文件中,我有很多看起来像这样的参考 n("./node_modules/core-js/modules/_to-length.js") 即使所有node_modules 的出现可以用 n 替换,我可以节省大约 15kb 的最终大小.

In the output file which is already minified I have lots of reference that look like this n("./node_modules/core-js/modules/_to-length.js") even if all occurrences of node_modules can be replaced with n, I can save around 15kb of final size.

推荐答案

我向您发布了一个类似的问题(链接)并意识到通过在 Webpack 配置中禁用 NamedModulesPlugin,它实际上只会从输出(不需要把它们弄成更短的东西).

I posted a similar question to yours (linked) and realized that by disabling the NamedModulesPlugin in the Webpack config, it'll actually just remove the reference paths altogether from the output (no need to mangle them to something shorter).

这篇关于Webpack 压缩路径名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆