lifenautjoe / webpack-starter-basic

A simple webpack starter project for your basic modern web development needs.
https://lifenautjoe.github.io/webpack-starter-basic/
578 stars 131 forks source link

Adding more pages #34

Open annamira opened 5 years ago

annamira commented 5 years ago

Hi @lifenautjoe !

Thank you for sharing the kit, it works great! Turns out the project I'm working on needs more than 1 page though. What would be a good way to add more pages to the app using this kit?

Thank you!

mensch commented 5 years ago

Not sure if this it the official way to do it, but you can extend the webpack config to make it cover more pages.

So the plugins entry in webpack.dev.js becomes like this:

    plugins: [
        new HtmlWebpackPlugin({
            template: './index.html',
            inject: true,
            filename: 'index.html'
        }),
        new HtmlWebpackPlugin({
          template: './another-page.html',
          inject: true,
          filename: 'another-page.html'
        })
    ]

The plugins entry of webpack.prod.js should have the same entries.

annamira commented 4 years ago

Thank you @mensch , will give it a shot!