Answer the question
In order to leave comments, you need to log in
How to set path to index.html in webpack?
How to set path to index.html in webpack? If you transfer it from the root, then npm run dev opens a list of directories in the browser. How to make it open index.html even if it's not in the root?
Answer the question
In order to leave comments, you need to log in
It all depends on what directories you want to work with.
You can set the devServer.contentBase parameter to the directory you need:
devServer: {
contentBase: path.join(__dirname, 'build', 'myFolder'),
}
devServer: {
before: (app, server) => {
app.get('/', (req, res) => {
res.sendFile(path.resolve(__dirname, './build/myFolder/index.html'));
});
},
},
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question