Home > OS >  how to remove the initial slash from bundle file path, publicPath, PUBLIC_URL in webpack with create
how to remove the initial slash from bundle file path, publicPath, PUBLIC_URL in webpack with create

Time:03-07

How can we remove the initial slash from all the files included automatically in index.html from webpack (like <script src="/static/js/...">...) and all the paths of a react app?

How is possible to customize the webpack.config.js in a react project created by the command line npx create-react-app without ejecting it?

CodePudding user response:

open the public/index.html removing all the slashes after/before %PUBLIC_URL%

for example

<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />

become

<link rel="icon" href="%PUBLIC_URL           
  • Related