webpack 不压缩代码

The webpack JavaScript utility has taken over the modern JavaScript landscape, so much so that it's hard to be a JavaScript developer and not use it. JavaScript build utilities are the point where they do best practices implicitly, like minify code, caching, and more.

webpack JavaScript实用程序已经占领了现代JavaScript领域,以至于很难成为一个JavaScript开发人员并且不使用它。 JavaScript构建实用程序是它们隐式地执行最佳实践的地方,例如最小化代码,缓存等。

I was recently debugging a bundled webpack app and it quickly became clear that the only way forward was debugging the actual source, not the minified code. Duh.y

我最近正在调试捆绑的webpack应用程序,很快就知道前进的唯一方法是调试实际源代码,而不是最小化的代码。 杜伊

To prevent webpack from minifying the source, add the following to your webpack config:

为了防止webpack缩小源代码,请将以下内容添加到webpack配置中:

{
    // .... other webpack, like output, etc.
    optimization: {
        minimize: false
    },
}

This simple flag makes debugging easier, if only enabled for a moment. I love how webpack allows you to take advantage of its feature set while being able to disable really quickly!

如果仅启用一小段时间,此简单标志将使调试更加容易。 我喜欢webpack如何让您充分利用其功能集,同时又能Swift禁用它!

翻译自: https://davidwalsh.name/how-to-not-minify-source-with-webpack

webpack 不压缩代码

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐