dilanx / craco

Create React App Configuration Override, an easy and comprehensible configuration layer for Create React App.

Home Page:https://craco.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(React)All response data is the content of index.html(after craco build,it was normal before build)

ChenKe404 opened this issue · comments

commented

What's happening
(React)All response data is the content of index.html(The same if the back-end server is not started)
response data:
<!doctype html><title>React App</title><script defer="defer" src="/static/js/main.b2a3add8.js"></script>You need to enable JavaScript to run this app.

What should happen
the data from server,like json or text

To reproduce

  1. craco build
  2. serve -s build
  3. axios request

CRACO version
(ex. 7.0.0)

CRACO config
const path = require('path')
const resolve = dir => path.resolve(__dirname, dir);
module.exports = {
webpack: {
alias: {
"@": resolve("src"),
}
}
}

package.json
"dependencies": {
"@ant-design/icons": "^4.8.0",
"@craco/craco": "^7.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"antd": "^5.0.4",
"axios": "^1.2.1",
"http-proxy-middleware": "^2.0.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^5.3.4",
"react-scripts": "5.0.1",
"spark-md5": "^3.0.2",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject"
},

Additional information
No

commented

I'm stupid.