K
K
KirSupi2022-04-15 22:20:47
React
KirSupi, 2022-04-15 22:20:47

How to set React bundle path?

There is a React code, I use React Router v6.
If I am on the site.ru/path/path page , and then I update, the site does not open . I
looked through the developer tools, the problem is that the browser is trying to load files relative to this path, t .e. for example, not site.ru/main.js , but site.ru/path/main.js
This is due to the fact that index.html is added during the build. <script src="main.js"/>
I want to change this so that it was <script src="/main.js"/>
How can this be done?
Well, or if I'm trying to fix it wrong, please tell me how to fix this problem

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Goretsky, 2022-04-16
@KirSupi

in the output section there should be an option:
publicPath: "/"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question