S
S
sergeyviktorovich2021-10-26 21:00:35
React
sergeyviktorovich, 2021-10-26 21:00:35

Why does webpack-dev-server look for files in a subdirectory after a reboot, but in the root?

went to the page from the main page everything was fine reloaded
192.168.43.251:8080/chapter/zametki-rabota , looking for css and js here, although they are at the root
and for some reason HtmlWebpackPlugin inserts like this without a slash and a dot

<script defer="" src="bundle.js"></script>
<link href="main.css" rel="stylesheet">


zametki- rabota
:1 Refused to apply style from ' 192.168.43.251:8080/chapter/main.css ' because its MIME type ('text/html' ) is not a supported stylesheet MIME type, and strict MIME checking is

enabled

devServer: {
        historyApiFallback: true,
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
ikutin666, 2021-10-27
@ikutin666

it searches by default at the root of the project, you need to specify

devServer: {
 static: {
      directory: path.join(__dirname, 'zametki-rabota'),
    },
        historyApiFallback: true,
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question