dilanx / craco

Create React App Configuration Override, an easy and comprehensible configuration layer for Create React App.
https://craco.js.org
Apache License 2.0
7.43k stars 499 forks source link

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

Closed ChenKe404 closed 1 year ago

ChenKe404 commented 1 year ago

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>React 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

ChenKe404 commented 1 year ago

I'm stupid.