LoginSignup
15
18

More than 5 years have passed since last update.

Vue CLI 3で、minifyされてないHTMLを書き出す方法

Last updated at Posted at 2018-08-21

方法をみつけるのに苦労したため書いておきます。

公式
https://cli.vuejs.org/guide/

vue.config.jsをプロジェクトルートに作成し下記記述。

module.exports = {
  chainWebpack: config => {
    config.plugin('html').tap(options => {
      options[0].minify = { 
        removeComments: false,
        collapseWhitespace: false,
        removeAttributeQuotes: false,
        collapseBooleanAttributes: false,
        removeScriptTypeAttributes: false
      }
      return options
    })
  }
}

ちなみにファイル名後ろの乱数生成をさせないようにするには

module.exports = {
  filenameHashing: false
}
15
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
15
18