Giter Site home page Giter Site logo

Leading slash is added when using @cypress/instrument-cra for `react-scripts build` with PUBLIC_URL without leading slash defined about instrument-cra HOT 2 OPEN

cypress-io avatar cypress-io commented on May 29, 2024
Leading slash is added when using @cypress/instrument-cra for `react-scripts build` with PUBLIC_URL without leading slash defined

from instrument-cra.

Comments (2)

RichieRunner avatar RichieRunner commented on May 29, 2024

Bump on this issue. @TomaszG have you been able to resolve this?
This pathing issue is causing my NP builds to not work in CI environments. I guess this instrumentation package is only ideal for local usage.

from instrument-cra.

TomaszG avatar TomaszG commented on May 29, 2024

The solution is to use sed command run after build on build output files :) In my project we build the project with PUBLIC_URL=PUBLIC_URL_PLACEHOLDER and we replace the PUBLIC_URL_PLACEHOLDER before start script (with custom docker-entrypoint.sh) so we have an option to run the app under different base paths, without rebuilding the app image.

For an easy solution you can try building the app with PUBLIC_URL=PUBLIC_URL_PLACEHOLDER and adding postbuild script like this: PUBLIC_URL=test find ./build -type f -exec sed -i -e "s|/PUBLIC_URL_PLACEHOLDER/|$PUBLIC_URL/|g" {} \;

I'm on my phone currently, so I'm not able to tell if everything is correct, however, this should help you get the idea.

from instrument-cra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.