question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to build not minified files using @vue/cli

See original GitHub issue

Version

3.9.3

Environment info

Environment Info:
node 10.
  System:
    OS: macOS 10.14.1
    CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
  Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    Yarn: 1.3.2 - /usr/local/bin/yarn
    npm: 6.9.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 75.0.3770.142
    Firefox: Not Found
    Safari: 12.0.1
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0
    @vue/babel-plugin-transform-vue-jsx:  1.0.0
    @vue/babel-preset-app:  3.9.2
    @vue/babel-preset-jsx:  1.0.0
    @vue/babel-sugar-functional-vue:  1.0.0
    @vue/babel-sugar-inject-h:  1.0.0
    @vue/babel-sugar-v-model:  1.0.0
    @vue/babel-sugar-v-on:  1.0.0
    @vue/cli-overlay:  3.9.0
    @vue/cli-plugin-babel: ^3.9.0 => 3.9.2
    @vue/cli-plugin-eslint: ^3.9.0 => 3.9.2
    @vue/cli-plugin-unit-mocha: ^3.9.0 => 3.9.0
    @vue/cli-service: ^3.9.0 => 3.9.3
    @vue/cli-shared-utils:  3.9.0
    @vue/component-compiler-utils:  2.6.0 (3.0.0)
    @vue/eslint-config-airbnb: ^4.0.0 => 4.0.1
    @vue/preload-webpack-plugin:  1.1.0
    @vue/test-utils: 1.0.0-beta.29 => 1.0.0-beta.29
    @vue/web-component-wrapper:  1.2.0
    eslint-plugin-vue: ^5.0.0 => 5.2.3 (4.7.1)
    vue: ^2.6.10 => 2.6.10
    vue-eslint-parser:  5.0.0 (2.0.3)
    vue-hot-reload-api:  2.3.3
    vue-loader:  15.7.1
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.6.10 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vue2-touch-events: ^2.0.0 => 2.0.0
  npmGlobalPackages:
    @vue/cli: 3.9.3

Steps to reproduce

npm run build

What is expected?

js not be minified

What is actually happening?

js always minified


how can i modify optimization.minimizer to disable minify by default

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

22reactions
sodateacommented, Jul 23, 2019
// vue.config.js
module.exports = {
  chainWebpack: config => config.optimization.minimize(false)
}
8reactions
camslicecommented, Mar 6, 2020

Ah thanks @sodatea , sort of works… but still minifies component HTML.

I added the following to vue.config.js:

module.exports = {
  chainWebpack: config => {
    config.plugin('html')
      .tap(args => {
        args[0].minify = false
        return args
      })
  }
}

The result is that everything outside of <div id="app"/> is not minified, but all the component HTML is still minified.

I’m using the prerender-spa-plugin as recommended here to prerender the app to static HTML files.

The default for the prerender is to not minify, but I also tried explicitly setting this to false but had no effect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue cli build without minification - Get Help
Ive tried all these steps mentioned in this thread, but to no success. https://forum.vuejs.org/t/vue-cli-3-0-0-vue-config-minimize-compress- ...
Read more >
How to disable minified in vue-cli? - Stack Overflow
I wanna the production code is not minified in dist/ with @vue/cli 4.1.2. 1、first try set vue.config.js
Read more >
This is my deployed, production build of a Vue CLI ... - Reddit
My production build creates a dist folder with nothing but HTML, CSS and Javascript files (plus, images, whatever).
Read more >
No build step | Code Cookbook - Michael Currin
Here is how to add Vue to your site - without a build step. You don't need Vue CLI, Webpack or even Node....
Read more >
Build Options - Vite
If the build.minify option is 'terser' , 'esnext' will be forced down to 'es2021' . In other cases, it will perform no transpilation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found