I'm new to using webpack and right now I've just got a basic setup with an index.html page that has a reference to a test page like so: <a href="/test.html">license</a>
Right now, webpack is loading the index.html page into a dist folder using the HTMLWebpackPlugin, and my test.html file is staying in my src folder. What I want to achieve is for the test.html file to also be loaded into the dist folder, but for the href within the index.html file to automatically be updated. This is because when I'm using the HTMLWebpackPlugin, I am renaming the HTML files that go to the dist folder with names such as dist-index.html and dist-test.HTML for clarity. Is this possible?
If you want to use multiple HTML pages with webpack you should use this code example:
plugins: [
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.html',
chunks: ['main']
}),
new HtmlWebpackPlugin({
filename: 'example.html',
template: 'src/example.html',
chunks: ['exampleEntry']
})
]
Instead if you are using some libraries like React, you should install react-router-dom and use the default configuration.