Using the script directly breaks assets
See original GitHub issueHi there!
So I’m having the following situation:
I created an app using create-react-app
(this repo), which has some assets.
The app is used to work as a plugin on many different sites/apps. So the purpose is to provide it in 2 possible ways:
- Use inside an iframe and pass parameters via the URL
<iframe src="https://plugin.domain.com/plugin-name/version-number?param1=value1¶m2=value2"></iframe>
- Use a
div
with the correctid
and a separate<script>
tag that points to the script (which is duplicated fromstatic/js/main.*.js
tomain.js
in the root) and pass params via thedataset
<div id="plugin-name" data-param1="value1" data-param2="value2"></div>
<script type="text/javascript" src="https://plugin.domain.com/plugin-name/version-number/main.js"></script>
When using the iframe
, everything works like expected. But when using the div
+ script
, I get the following error:
Failed to load resource: the server responded with a status of 404 (Not Found)
Any idea how I can fix this or what the preferred way of doing something like this is?
Issue Analytics
- State:
- Created 6 years ago
- Comments:32 (31 by maintainers)
Top Results From Across the Web
NPM Scripts using watch works in CLI but breaks in npm scripts
Try surrounding the command with quotes and see if it works: "sass:watch": "watch \"npm run sass:build\" ./assets/styles/". Explaination:.
Read more >The Complete Guide to Mastering Script Breakdown Elements
Now we're going to dive into the details and guide you through the complex process of sorting and categorizing your script breakdown elements....
Read more >Script Breakdown: Everything You Need to Know - NFI
A script breakdown is used to figure out shooting requirements for every scene in a film shoot including budget, schedule, and prep work....
Read more >Using Scripts - Background - ServiceNow Developers
We are experimenting with new training content delivery methods. This tutorial blog post is one of those experiments.
Read more >break - JavaScript - MDN Web Docs - Mozilla
The following code uses break statements with labeled blocks. A break statement must be nested within any label it references. Notice that ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gaearon I found it in their docs 🙂 https://webpack.js.org/guides/public-path/#on-the-fly
@MichaelDeBoey you might want to have a look at this: https://itnext.io/so-you-want-to-host-your-single-age-react-app-on-github-pages-a826ab01e48
If you want to pre-deploy or deploy you could even have a bash script to take care of the PUBLIC_URL parameters.
FYI @gaearon