-
-
Notifications
You must be signed in to change notification settings - Fork 132
feat: add support for configuring the base URL #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
✔️ Deploy Preview for modest-rosalind-098b67 ready! 🔨 Explore the source changes: cb46528 🔍 Inspect the deploy log: https://app.netlify.com/sites/modest-rosalind-098b67/deploys/61f28aa9b317d1000834f93a 😎 Browse the preview: https://deploy-preview-248--modest-rosalind-098b67.netlify.app |
src/index.tsx
Outdated
| return './js/monaco/json.worker.bundle.js'; | ||
| } | ||
| // for yaml worker | ||
| if (label === 'yaml' || label === 'yml') { | ||
| return '../../js/monaco/yaml.worker.bundle.js'; | ||
| return './js/monaco/yaml.worker.bundle.js'; | ||
| } | ||
| // for core editor worker | ||
| return '../../js/monaco/editor.worker.bundle.js'; | ||
| return './js/monaco/editor.worker.bundle.js'; | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the former paths just worked by accident because .. does nothing when already at the root path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, if we load bundled JS file in the index.html then we can use path from root. In the preview I see that it works, but there is a question: why does it also work in current deploy on https://studio.asyncapi.com where we have that old path? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I wonder if we should use it here process.env.PUBLIC_URL to be more safe?
|
@magicmatatjahu We noticed this after deploying the new Docker image from #240 to our Kubernetes cluster. Maybe you can have a look again? |
5d885af to
b6bf887
Compare
Hi! No problem, I hope that I will make review today! I already made 4/5 reviews today and nexts wait for me 😅 |
magicmatatjahu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fgreinacher Thanks for your contribution! :) We are very thankful but I have a few comments, please refer to them :)
src/index.tsx
Outdated
| return './js/monaco/json.worker.bundle.js'; | ||
| } | ||
| // for yaml worker | ||
| if (label === 'yaml' || label === 'yml') { | ||
| return '../../js/monaco/yaml.worker.bundle.js'; | ||
| return './js/monaco/yaml.worker.bundle.js'; | ||
| } | ||
| // for core editor worker | ||
| return '../../js/monaco/editor.worker.bundle.js'; | ||
| return './js/monaco/editor.worker.bundle.js'; | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, if we load bundled JS file in the index.html then we can use path from root. In the preview I see that it works, but there is a question: why does it also work in current deploy on https://studio.asyncapi.com where we have that old path? 🤔
| COPY package.json package-lock.json ./ | ||
| RUN npm install --frozen-lockfile | ||
|
|
||
| COPY ./ ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why these commands are split? What we have benefit here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a common optimization to speed up Docker builds. It will cache the result of npm install and not execute it unless package.json or package-lock.json have changed.
| FROM docker.io/library/nginx:1.21.5-alpine as runtime | ||
|
|
||
| ARG BASE_URL_PLACEHOLDER | ||
| ARG ENTRYPOINT_SCRIPT=/docker-entrypoint.d/set-public-url.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add info about docker-entrypoint.d? Tbh I had to read about it, because I didn't know about that 😅 You know, for future contributors to help them understand that step.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure! I added a comment!
src/index.tsx
Outdated
| return './js/monaco/json.worker.bundle.js'; | ||
| } | ||
| // for yaml worker | ||
| if (label === 'yaml' || label === 'yml') { | ||
| return '../../js/monaco/yaml.worker.bundle.js'; | ||
| return './js/monaco/yaml.worker.bundle.js'; | ||
| } | ||
| // for core editor worker | ||
| return '../../js/monaco/editor.worker.bundle.js'; | ||
| return './js/monaco/editor.worker.bundle.js'; | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I wonder if we should use it here process.env.PUBLIC_URL to be more safe?
b6bf887 to
cb0435b
Compare
cb0435b to
60d9fa1
Compare
@magicmatatjahu I cannot comment inline, no idea why... Yes, that makes sense. I think I addressed everything, much better now! |
|
Kudos, SonarCloud Quality Gate passed!
|
|
@fgreinacher Ok, I checked and everything works. Thanks very much for contribution! If you will have any problems with new docker image please ping me in this PR :) |
|
/rtm |
|
🎉 This PR is included in version 0.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |









Description
See the related issue for context.
This PR introduces the following changes:
PUBLIC_URLto a placeholder value during Docker build socreate-react-appinjects the placeholder value in generated assets (see https://create-react-app.dev/docs/advanced-configuration/ and https://create-react-app.dev/docs/deployment/#building-for-relative-paths)PUBLIC_URLvariable has not been used up to now (see https://create-react-app.dev/docs/using-the-public-folder/)Related issue(s)
Closes #249