create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Fonts have wrong relative paths when built for relative paths.

Open Ferezoz opened this issue 9 years ago • 4 comments

Is this a bug report?

Yes

Steps to Reproduce

  1. install dependencies: npm install --save bootstrap npm install --save font-awesome

  2. import styles to index.js: import '../node_modules/bootstrap/dist/css/bootstrap.min.css'; import '../node_modules/bootstrap/dist/css/bootstrap-theme.min.css'; import '../node_modules/font-awesome/css/font-awesome.min.css';

  3. configure build for relative paths: add "homepage": ".", to package.json

  4. build: npm run build

Expected Behavior

On static/css/main.XXXXXX.css fonts paths should have for example: ../media/glyphicons-halflings-regular.XXXXXXX.woff or ../media/fontawesome-webfont.XXXXXXX.woff

Actual Behavior

On static/css/main.XXXXXX.css fonts paths have for example: ./static/media/glyphicons-halflings-regular.fa277232.woff or ./static/media/fontawesome-webfont.fee66e71.woff

Ferezoz avatar Jul 14 '17 23:07 Ferezoz

I just tested this and it works fine. Please provide a project reproducing this.

Timer avatar Jul 15 '17 05:07 Timer

Also, why not the following?

import 'bootstrap/dist/css/bootstrap.min.css';

Timer avatar Jul 15 '17 05:07 Timer

I'm going to close this as there's been no activity and I was not able to repro.

Timer avatar Jul 18 '17 04:07 Timer

Thank you for your response, I had an earlier version of react-scripts and that was the problem, I updated it and now my fonts have right paths when built.

Ferezoz avatar Jul 20 '17 19:07 Ferezoz