What is the right way to set a different <base> for dev/staging/production

前端 未结 6 604
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-10 01:07

for dev and production are different(for production it\'s subfolder). What is the good way to build different base with webp

6条回答
  •  难免孤独
    2020-12-10 01:42

    If you have a template option set to an HTML file then Version 2.x of the plug-in will not perform any substitution.

    In this case, you will need to modify @stever's answer as follows:

    new HtmlWebpackPlugin({
      ...
      template: './src/index.ejs',
      baseUrl: process.env.NODE_ENV == 'development'?'/':'/app/'
    })
    

    and rename your index.html file to index.ejs

提交回复
热议问题