mrgalaxy:stripe App is not defined - meteor

This Meteor web browser site uses the package mrgalaxy:stripe, The first instruction is to
put App.accessRule('https://*.stripe.com/*'); in a client side file mobile-config.js.
Which when done exactly, causes the browser to issue an error:
Uncaught ReferenceError: App is not defined
I looked in Meteor doc but could not figure it out.
Any idea how to fix this? Thanks

You should have that file in the root of your app, not inside your client folder.
From mrgalaxy:stripe documentation:
In order for Stripe.js to be loaded directly on iOS and Android a new rule needs to be created in your mobile-config.js located in the root of your project. Create the new file if it doesn't already exist and insert the line below.
This is necessary for mobile builds to access external URLs. If you're building a mobile app from Meteor, you'll need to add additional configuration info to that mobile-config.js file before deploying. See https://docs.meteor.com/api/mobile-config.html

Related

Uncaught SyntaxError: Unexpected token '<' - after deploying my react redux application using Firebase

I recently used Google's Firebase to deploy my application. But somehow something is going wrong. Please access the below link to view the exact error trace.
In my build, everything looks normal all the CSS files and JS files have the appropriate code but after the deployment all the Files have HTML, go through the Below URL and watch the console to have a better idea of the error.
https://workout-wfh.web.app/
View both Images to view the difference :
1. In the deployed application
In my local build
If you view the source of the deployed website, you'll see that the <script> tag is trying to load this URL:
https://workout-wfh.web.app/MohanVarma1965/workout.git/static/js/main.5cca3537.chunk.js
which doesn't exist and so is falling back to your default HTML content. It looks like your build process is generating absolute URLs that include your username and directory path. You should adjust your build tooling to leave out everything before /js.

Loading ReactJS on asp.net view issues with image path

I'm trying to load a React app onto an asp.net view (project was initially written in asp.Net, am creating new pages using React for learning purposes and for fun).
When the React app is running in dev move, all images load without any issue with all pathing working.
After building the app using npm run build, the js file and corresponding image files are generated and I place them on a folder on my asp.net application (e.g. Scripts folder).
When I try to view the page, the React app loads and the screen is rendered, but the images are all broken as the website can't find them.
After looking to see why the images aren't loading, they're getting a 404 not found error due to the images trying to be loaded from the current URL, rather than where the js file and images are stored.
For example, the view which loads the React app is on https://localhost/Home/ReactPage
And ReactPage.cshtml has the following in it:
<div id="thisIsTheReactDiv"></div>
<script src="/Scripts/ThisFolder/app.js" type="text/javascript"></script>
The React app js is in the Script folder in the project, so to access it, the src has been put as shown above. To access the image you'd have to do something like https://localhost/Scripts/ThisFolder/image.png
At this stage what it's doing is the image is being linked to https://localhost/Home/ReactPage/image.png which causes a 404 error.
Are there any webpack configs that can be done to make it point to a specific path before it gets built?
Is there any way to make the React app when building for PROD update the image relative paths so it looks at a specific folder rather than trying to get it from the current path?
Alright, after a few hours of searching (which lead me to post this question), I've figured out how Webpack works with relative pathing now.
Looks like there's a section called "publicPath" in the output setting where you can type in to get the path relative to where your React JS file is deployed at.
So it looks like typing in
publicPath: "/Scripts/ThisFolder/",
will make the relative path to start from there so all images will load from that URL.
As seen from this Stack Overflow link: What does "publicPath" in Webpack do?

my NativeScript app dosent display the google maps

here is my code :
https://github.com/jonny720/do-here-client/tree/master/do-here
i took the map component code from here :
https://github.com/dapriett/nativescript-google-maps-sdk/tree/master/ng-demo/app/map
the map component should display the google maps but nothing is shown.
*i installed google maps sdk, and setup the api key in the android platform.
its the first time i'm working with api in my app.
can someone light my eyes and tell me what is the problem?
The api key is missing and you should register custom element in main.ts file, and the 2 files to copy from the nativescript-google-map module were missing from your app folder
and as well as the key too.
I forked your repo and update the app, also created a .gitignore file to exclude unnecessary files and folder from repo.
I tested and it works fine.
You will have to update these files with your appropriate Google API key
> do-here/app/main.ts
> do-here/app/App_Resources/Android/values/nativescript_google_maps_api.xml
> do-here/app/App_Resources/Android/src/main/res/values/nativescript_google_maps_api.xml
and update this file to redirect all unauthorized access back to login page, changed it to test the map page
do-here/app/#shared/services/auth-guard.service.ts
ok first thank you a lot KielSoft
i solved it by typing in the cli :
tns tun android --clean

Meteor: relative/absolute path issue

I'm testing out some old code and I'm getting an error and it looks like its with these lines of code:
var targetFile='../../../../../public/image1.png';
var sourceFile='../../../../../../game4-dirs/public/image2.png';
fs.writeFileSync(targetFile, fs.readFileSync(sourceFile));
The error I'm getting is:
Error: ENOENT, unlink '../../../../../public/image1.png'
I seem to vaguely remember that public and game4-dirs aren't accessible like this relatively to the product but relatively to where meteor is installed to (or something like that, I can't quite remember).
Has this change in version 1.2.0.2? I was originally using v0.9.3.1
Thank you :)
If your Meteor application lives at myApp on disk then files under myApp/public will be available at root in HTML /. This means the url for image1.png should be simply /image1.png.
It looks like ../../../../../../game4-dirs/public/image2.png is trying to access a file that is not below your meteor app's root directory. Meteor won't allow this on the client for obvious security reasons. If you want to use image2.png you should move it to your app's /public directory and then refer to it in html with simply /image2.png

Integrating JSPM workflow with Wordpress development

Im trying to adopt JSPM as my package manager for Wordpress development but im failing at loading the main app file.
This is usually done with
<script>
System.import('./app');
</script>
The problem im running into is that jspm fails to load this file, trying to load in context of the current browser path http://localhost:3000/shop/app.js instead of the file system context.
I've tried to adjust some of the jspm's configuration options but couldn't get it to work.
Can you point in the right direction here?
When running on file:/// URLs, you need to set your baseURL to the current path. This can be done with:
System.config({ baseURL: '.' });
Either in your configuration file or in the page itself. Note that when you load pages on different path levels, this baseURL path needs to be adjusted so it may be advisable to specify it in the page itself.

Resources