NodeJS [SOLVED]: The index html file is not being generated with HtmlWebpackPlugin in Linux

NodeJS [SOLVED]: The index html file is not being generated with HtmlWebpackPlugin in Linux

Home Forums Scripting NodeJS Tutorials NodeJS [SOLVED]: The index html file is not being generated with HtmlWebpackPlugin in Linux

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #245853

    Cloudy Point
    Keymaster

    QuestionQuestion

    I have a react project and while building the project, this command runs:

    new HtmlWebpackPlugin({
      inject: true,
      template: 'public/index.html',
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeRedundantAttributes: true,
        useShortDoctype: true,
        removeEmptyAttributes: true,
        removeStyleLinkTypeAttributes: true,
        keepClosingSlash: true,
        minifyJS: true,
        minifyCSS: true,
        minifyURLs: true
      },
      filename: '/index.' + Date.now() + '.html'
    }),
    

    When I build the project in Windows, it generates the fingerprinted index file like index.1514560078687.html inside the folder build along with other assets and files.
    But, when I run it in Ubuntu, it generates all files but the index file. Even if I set filename: '/index.html', it won’t be generated.

    Any idea?

    #245854

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    Looks like HtmlWebpackPlugin stores index.html file in your root directory. Have you checked it?

    Try to add . before /index.html it might work for you.

    Thanks!

    Source: https://stackoverflow.com/questions/48025037/the-index-html-file-is-not-being-generated-with-htmlwebpackplugin-in-linux
    Author: The Reason
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.