i am working on a react app, created using "create-react-app". i have many pdf files stored in my public folder, inside an assets folder: public/assets/file.pdf
my app has to be running locally (without web server) and i need to load these files in order to display them. i cannot store the files elsewhere and get them via axios. it has to be from the public path
If someone has the info on how to do this, please enlighten me. thank you
I have tryed to do it this way : import("assets/filename")
i tried to put different urls, i took a look at the webpack config even tho i am no expert.
But it doesn't seem to work at all.
Take a look a react-pdf, it may help
Related
this probably is a newbie question, please don't be mean :D
I'm trying to add a js file to an html page, but can't load it properly. It seems to be a path related issue.
in the HTML page I'm linking the file with
<script src="../src/utils/mapbox.js"></script>
Then on my js file I simply put a console.log to see if the file is loaded properly, but it isn't :/
I tried everything but nothing changes.
screenshot of the debug console
screenshot of the source tab of the debuggin tool
On the second image, I can't see all of my folders I have on VSCode. It is because those file are server side right? If so, how can I solve the issue? :/
this is the folder structure in VSCode
Thanks in advance.
The value of the src attribute needs to be a URL to the JS file.
If you use a relative URL, it needs to be relative to the URL of the HTML document.
This is not the same as the path between the EJS template used to generate the HTML and a JS file on the local filesystem.
First you need to give the JS file a URL. You haven't shown the source code you've written for your websever, but it seems like a reasonable assumption to say that you have used the Express.js static module to make the contents of the public directory accessible.
The src directory is not inside public so it isn't accessible. It also appears to be a directory containing your server-side source code, so it isn't a suitable place to keep your client-side JS.
Move the client-side JS files into a directory inside the public directory.
(If you are writing isomorphic JS then you could create a new directory, perhaps called shared, and expose it using static too).
Once that is done, you can work out the URL to the JS file.
ok I digged into that issue and so basically, I was confusing between client side and server side. I looked at the mapbox api docs and immediately I clicked on the npm quick guide, but this is just for limited cases, when you need to render a map on the server.
All I needed to follow was the web js api of the mapbox service.
So thanks for the comments, I'll try to noob less and study more! :)
I am trying to create the basic scene but nothing is loading on my HTML page. I don't know where to get the three.js file that I need to place inside my js folder before I can reference it as instructed on the docs page ().
Please can someone explain how I can import this file and add it into my js folder?
It would be helpful if you could share some code to judge if this is an internal problem.
First of all, if you make references to local files, you'll need to run things locally running a local server (for instance I run python -m http.server, then access my files in the browser from localhost:8000).
The other problem could be that your version of three.js or three.min.js is not the good one, you can actually get them from the github build folder, and place them in the same repo as your html file, to be able to import them (<script type="text/javascript" src="three.min.js"></script>).
Finally, you could also see what's going wrong in your console if you work on Firefox for instance, it might help you to solve your error.
I'm trying for a while now to create a PWA in Oracle APEX by following some instructions on http://vmorneau.me/apex-pwa-part4/, but I'm having no luck in certain parts.
I've installed the demo to test it and see what's wrong, but I'm having the same issues with the demo app, namely some important files not being detected/found when I run it. I thought I had configured something wrong previously, but this time it was supposed to work properly.
Example, I have the app.js inside the js directory in Apex:
When I run the app, I get these messages:
I tried checking the file path the same way I tried to see if the manifest.json file was in the proper root folder, and it couldn't be found:
This looks like a common problem I see on the forums, that doesn't relate to the PWA concept. You'll probably find the same thing if you tried to refer to static files loaded into the workspace.
See Morten's example regarding a fixing the configuration
https://ora-00001.blogspot.com/2016/12/apex-plugin-files-and-404-not-found-in-ords.html
Or placed your files in the middle tier, using /i/ (or preferrably a custom location /c/)
I have two websites and in one of them I have some scripts that I want to use on the second website, I don't want to copy the .js files to the other projects, because if I had some change on the .js file I will have to do the same thing twice.
I don't know how can I do it, I've already read something abou Virtual Path Provider, but it apparently doesn't work fine for me, the .js files are in sub-folders, and the VPP won't find it.
Could someone give me ideas about what I should do?
I am creating a zimlet using js to generate a tree folder structure, but I also need it to include some files (default ones that are on the server). The problem is that I can't find a way to do this without asking the user to select the files manually. Any help on this?
You should check the zimbra soap which is realy helpful to you. I think you get the soap which upload the file in brifcase folder.