question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using the script directly breaks assets

See original GitHub issue

Hi 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:

  1. Use inside an iframe and pass parameters via the URL
<iframe src="https://plugin.domain.com/plugin-name/version-number?param1=value1&param2=value2"></iframe>
  1. Use a div with the correct id and a separate <script> tag that points to the script (which is duplicated from static/js/main.*.js to main.js in the root) and pass params via the dataset
<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?

CC: @gaearon @Timer

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:32 (31 by maintainers)

github_iconTop GitHub Comments

1reaction
MichaelDeBoeycommented, Jan 17, 2018
0reactions
jasonwrcommented, Jun 4, 2018

@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

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found