Nuxt.js: cannot disable minifying

Created on 19 Dec 2018  路  9Comments  路  Source: nuxt/nuxt.js

Version

v2.3.4

Reproduction link

https://jsfiddle.net/

Steps to reproduce

i have following config:
````
dev: true,

build: {
html: {
minify: {
collapseBooleanAttributes: false,
decodeEntities: false,
minifyCSS: false,
minifyJS: false,
processConditionalComments: false,
removeEmptyAttributes: false,
removeRedundantAttributes: false,
trimCustomFragments: false,
useShortDoctype: false
}
}
},

optimization: {
minimize: false,
},

generate: {
minify: false
},
````

but after running nuxt generate js files are still minified...

What is expected ?

to not minify the generated files

What is actually happening?

files are minified

This bug report is available on Nuxt community (#c8328)
bug-report stale

Most helpful comment

Webpack is doing the minification when using generate, the html.minify options seemingly do nothing.

Disable minification by adding the following to the build property's extend method:
config.optimization.minimize = false;

All 9 comments

Some parts in generated html is compressed in vue-ssr side instead of generate.minify, unfortunately Vue hasn't provided a way to serve pretty html in ssr.

https://github.com/nuxt/nuxt.js/issues/2151#issuecomment-345607089

'some parts' ? its looks to mi that everything is minified... :/

If your situation is same as the link in my previous comment, the minified parts in the screenshot are all from vue-ssr

Thanks for your contribution to Nuxt.js!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you would like this issue to remain open:

  1. Verify that you can still reproduce the issue in the latest version of nuxt-edge
  2. Comment the steps to reproduce it

Issues that are labeled as 馃晲Pending will not be automatically marked as stale.

any work on this issue, I also need this functionality. My Seo team also told me regarding this functionality

Webpack is doing the minification when using generate, the html.minify options seemingly do nothing.

Disable minification by adding the following to the build property's extend method:
config.optimization.minimize = false;

Hi, @clarkdo any updates?
I also need this functionality. Did you find the way how to disable html minify in build?

Hi @Akulko , have you tried build.html.minify: false ?

If so and you're only seeing minified html under <div id="__nuxt" data-server-rendered="true">, it's not controllable from Nuxt side as my above comment, because it's returned from vue ssr renderer.renderToString.

One potential way I can think is adding a hook like generate:done to use pretty tool like prettier to format html.

Hi, @clarkdo any updates?
I also need this functionality. Did you find the way how to disable html minify in build?

Please check the solution posted by @IronLionShawn, it works nicely and helped my team gain a 40% build speedup for dev environments. Just make sure to paste the snippet within the extend method that resides in your build section of the nuxt.config.js file.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bimohxh picture bimohxh  路  3Comments

nassimbenkirane picture nassimbenkirane  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

vadimsg picture vadimsg  路  3Comments

vadimsg picture vadimsg  路  3Comments