score:1
Accepted answer
in your root project add a file called .env
,
inside the file enter the path you want:
public_url=/v2/
this should fix your problem.
if you want to modify webpack.config.js
in a react project created with npx create-react-app
i suggest you to install craco
https://www.npmjs.com/package/@craco/craco .
after the installation you need to replace some lines of your package.json
from
...
"scripts": {
"start": "react-script start",
"build": "react-script build",
"test": "react-script test",
"eject": "react-script eject"
},
...
to
...
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "craco eject"
},
...
after that, in your root project add a file called craco.config.js
inside the file add the following code
module.exports = {
configure: {
output: {
publicpath: '/v2/'
}
}
}
}
Source: stackoverflow.com
Related Query
- How to change the publicPath in Create React App
- How to change PublicPath for Create React App in Dev Environment
- How to create a React app directly in the current folder
- How to change the domain name on a local deployed React app
- How to determine the order of css in my create react app build with webpack and customize-cra?
- How create a react app with a specific version using the npx command?
- How can I get rid of the `Node "13.0.0-nightly20190802452b393c1f"` so that I can be able to create a react app using the `create-react-app` tool?
- How to change the React App localhost:3000 IP to my IP?
- React: how to change the state if something outside the react app changes?
- How to create a play against the computer function to my react app
- How do I deploy an react app to azure and change the default page
- How can I change the URL for a React app that I'm hosting myself and to which I forward a domain?
- how to dynamically change the message in popup in React App
- How to get React App change content on the screen when screen width changes
- How do i Change Create react app folder structure
- how to create automatic background image change in react native every time app opens up?
- How to show a loading indicator in React Redux app while fetching the data?
- What is the difference between NextJs and Create React App
- How to create multiple page app using react
- How to fetch the new data in response to React Router change with Redux?
- How to detect the device on React SSR App with Next.js?
- The react-scripts package provided by Create React App requires a dependency:
- How to not show warnings in Create React App
- You are running `create-react-app` 4.0.3, which is behind the latest release (5.0.0). We no longer support global installation of Create React App
- How to include custom JS files in to React create app
- How do you change the Stepper color on React Material UI?
- How to change multiple properties of a state in react (at the same time)?
- How to inject port and host using ENV variable in Create React App Proxy settings?
- How to load the google maps api <script> in my react app only when it is required?
- How to fix TypeError _interopRequireDefault is not a function in Create React App
More Query from same tag
- Input Field Onchange not allowing to type
- How to toggle color mode change on a Switch Chakra UI component?
- How to fetch data from Instagram api with Axios and Reactjs?
- Building a reusable component to map through different sets of data React
- Using React and Redux Hooks, why is my action not firing?
- Webpack React build throwing errors on html tags
- unable to find a React.Component by id
- Why is react-native-image-picker's showImagePicker undefined in React Native?
- React: Proper state mutation with setState hook
- 'ckeditor4-react' and 'HTML5 video' plugin
- Why can't I convert this to a custom React hook?
- React JS Multiple submit Buttons react-hook-form
- How to migrate componentWillReceiveProps in react 16.0.0?
- Issue with useState() being asynchronous
- Not able to reduce the size of image in Material UI CardMedia in a React component
- TypeScript Styled-Components Theme property returning undefined
- Component nesting in react with ES6 syntax
- Error handling in useLazyQuery hook of RTK Query?
- Use callback definition of a functional component outside the component
- how to move second component in react js?
- How can i update context value with the state value
- styled-system | Resolve theme style function within component
- hide/show ion-card element reactJS
- How do I retrieve value from async function in react?
- 'Property does not exist' in a Functional Component with added functional components as properties to it?
- how to display the first and last grid complete in chart js in type line
- Load local image in React JS
- How to use TypeScript with a custom hook for reactjs useContext?
- How can I get documents from Firestore for current user?
- How to handle the `onKeyPress` event in ReactJS?