using Gatsby, the build fails, - build

I get a new bug, when trying to do yarn build
2 | //# sourceMappingURL=react-table.production.min.js.map
3 |
WebpackError: ReferenceError: regeneratorRuntime is not defined
image is attached
this is coming from a component that uses react-table, this is a new bug that "suddenly" happened.
any tips?

As you can follow in this Gatsby discussion what ends in this thread from react-table the issue rises because of the useAsyncDebounce you're using, which internally uses async/await.
You have two solutions:
Importing regenerator-runtime/runtime at the top of your component:
import 'regenerator-runtime/runtime';
import React from 'react';
import {
useAsyncDebounce,
useFilters,
useGlobalFilter,
useTable,
} from "react-table"
Configuring your browserlist to include the polyfill automatically. In your package.json:
{
"browserslist": [">0.25%", "not dead", "since 2017-06"]
}
You have to add a version that’s recent enough to support async/await, so Babel does not try to add a polyfill. Check them at https://github.com/browserslist/browserslist

Related

ember-electron application start (code hierarchy)

I'm trying to move a very old 2.x ember-electron application to new electron with ember-electron and got application window with blank screen and error in console:
(node:9061) electron: Failed to load URL: serve://dist/ with error: ERR_FILE_NOT_FOUND
The calling file ../new-ember-electron/electron-app/src/index.js has lines from old applications:
const emberAppLocation = 'serve://dist';
mainWindow.loadURL(emberAppLocation);
File ../new-ember-electron/app/router.js has:
this.route('index', { path: '/' }, function() {}
Files ../new-ember-electron/app/routes/index.js, ../new-ember-electron/app/controllers/index.js and ../new-ember-electron/app/templates/index.hbs also exist.
So, it's unclear what exactly is not found and how to find a more detailed error (application developer console doesn't have errors). But if to change the mentioned 2 lines in ../new-ember-electron/electron-app/src/index.js to:
const emberAppLocation = '../app/index.html';
mainWindow.loadFile(emberAppLocation);
then application shows content of the correct file, despite nothing working in it, even <LinkTo>...</LinkTo> is not treated as a link.
Would you please help me to understand how an ember-electron application should be structured and which way is called for the recent versions?
Used versions: node - 16.14.0, electron: 17.0.1, ember-cli: 3.28.5, ember-electron: 3.1.0, OS: darwin x64.
Thank you.
Thank you, jacobq, I've looked at your example and used emberAppUrl to start from ember-dist/index.html file. After few more changes related to require/requireNode (fixed with webPreferences options in mainWindow) the app rendered index.html file. But a problem with app location happens again right on {{ content-for "body" }} in index.html: "Uncaught Error: Cannot find module 'app-name/app'" where app-name is the application name set up as 'name' in /package.json and as 'modulePrefix' in config/environment.js. The error itself comes from /node-modules/ember-cli/lib/utilities/ember-app-utils.js, 'contentFor' function called with 'app-boot'. The ember-cli itself constructs the /app-name/app path. So, the question now is what exactly ember-cli expects to find during the boot with the new structure? Or maybe some config variable should be added to let know Ember about the /app-name/app location?
Edited:
jacobq, yes, the only difference in index.html is application name: "testapp". RootURL is set in ../testapp/config/environment.js:
podModulePrefix: 'testapp/pods',
environment,
modulePrefix: 'testapp',
rootURL: process.env.EMBER_CLI_ELECTRON ? '' : '/',
locationType: process.env.EMBER_CLI_ELECTRON ? 'hash' : 'auto',
The full error:
It happens when testapp.js file is called from index.html, on code included from ember-cli:
if (!runningTests) {
require("testapp/app")["default"].create({"LOG_TRANSITIONS":true,"LOG_TRANSITIONS_INTERNAL":true});
}
First thing I'd like to plug is joining the #topic-desktop channel on the Ember.js community Discord server: https://discord.com/channels/480462759797063690/488735754139336714
(it's often easier to work things out by chatting there as there's lower latency than typically found with forum post/reply platforms)
Secondly, there are lots of breaking (but good) changes between ember-electron 2.x and 3.x, so I'd encourage you to work through the upgrade guide here: https://ember-electron.js.org/docs/guides/upgrading
That said, I suspect that the problem you're seeing is related to the change from serve:// to file://. Have a look at the demo app I just spun up here:
https://github.com/jacobq/ember-electron-demo
You can see the new emberAppURL here:
https://github.com/jacobq/ember-electron-demo/blob/cf7c5dee2cd975f8c67ed1dfc61eb717461f5b7d/electron-app/src/index.js#L13
Basically, ember-electron v3.x puts the usual dist output from ember build into <project_root>/electron-app/ember-dist/ now.
FWIW, I'm actually stuck on 3.0.0-beta.2 in my application because I am using IndexedDB and don't have migration code to deal with origin-related issues of switching to file:// scheme. I don't recommend that you use that version, but you could try it if you wanted to see if that changes the error you're encountering (because that beta still uses electron-protocol-serve).

Is Intl.Collator possible in an Expo Managed react native app?

Do Expo managed react native apps have access to an Intl Collator?
I don't see it in the docs but thought I'd ask.
Looking to use it for sorting like this 👇.
import { createNewSortInstance } from 'fast-sort';
const naturalSort = createNewSortInstance({
comparer: new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' }).compare,
});
It will be in the next SDK that includes React Native 65.0. See https://reactnative.dev/blog/2021/08/17/version-065#whats-new-in-hermes-08 and https://expo.fyi/react-native-releases

Expo Image Picker vs RN-image picker

I am quite new to RN . I know this question is being repeated but I didn't quite get ans I was looking for there .
So my current project uses
expo for web and react-native cli for the android set up .
I want to add an image-picker to the project.
I see two options at my side .
RN-image-picker
expo-image-picker
I have some issues and some questions !!
Is RN-native-image picker comaptible with web ??
I think its not ,there are two resons I think that ,this lib uses Nativemodules, which
won't be bundled for web and its giving undefined error for NativeModules when I run with
web while it works fine on android .
Should I use expo-image-picker when I am creating a android build with react-native cli ??
The build doesn't give errors and it shouldn't ,but when I click on upload image ,app
crashes after I select image.I read the docs and github for the issue.Many people pointed
out its ram allocation issue,which can be sorted with disbaling "Dont keep activities" in
developer's option,which I haven't tried yet .
Also on web ,the following code snippet returns base64 as uri,is it default behaviour ??
I am using this code snippet for expo-image-picker,which ends up crashing app when I build app with rn cli,but doesn't seem to cause issues with expocli build.But I want to use expo for web and rn for android.
Also on web ,the following code snippet returns base64 as uri,is it default behaviour ??
const pickImage = async () => {
try{
let result = await ImagePicker.launchImageLibraryAsync({
mediaTypes: ImagePicker.MediaTypeOptions.Images,
allowsEditing: true,
aspect: [4, 3],
quality: 1,
base64:false
})
if(!result.isCancelled)return result.uri ;
}catch(err){
console.log(err) ;
}
}
So what should I do in this case,use expo-image-picker as it seems to be compatible with all platforms/both ?
Any kind of input would be helpful !!
I'm not a fan of Expo, and I don't have experience with that but I try to answer to your question that can be.
Is RN-native-image picker comaptible with web ??
You have right, the library supports only mobile devices.
Should I use expo-image-picker when I am creating an android build with react-native cli ??
From expo documentation, I read that but I know also that sometimes the rn-cli and expo has some package differences, and this answer proves that.
Expo never locks you in, you can "eject" at any time and your project will just be a typical native project with the React Native and Expo SDK packages that your app is using installed and configured.
I don't know what the exception, and maybe the solution that you put in your answer work well, but maybe is possible to have some dependency mismecc? Such as a none object on the Web app? or something like that.
Also on web ,the following code snippet returns base64 as uri,is it default behaviour ??
This looks like be an bug and this issue on github maybe can confirm my idea

Ionic2 InAppBrowser

Hi I want to put a button in my page when clicked it will launch the website of the given item. However I got a problem and I don't know how to fix it. I just followed a recent tutorial online but unfortunately it didn't worked for me.
1.) This is the error appearing when I click on the button, circled in the image.
2.) Declaration of the constructor in the js file
3.) html button
4.) App version
Add
import {InAppBrowser} from 'ionic-native';
Also I did not see this in your .js file
launch(url) {
this.platform.ready().then(() => {
open(url, "_blank", "location=no");
});
}
This is required.
Add
cordova plugin add cordova-inappbrowser
In your ts file just add this line under your imports and above your #component
declare var cordova ;
Once the platform is ready just add the below lines.
cordova.InAppBrowser.open(url, '_blank', 'location=yes')
Here is the example explained as how to open a browser in ionic-2.
https://www.thepolyglotdeveloper.com/2016/01/launch-websites-with-ionic-2-using-the-inappbrowser/

goamz/sqs/md5.go:57: undefined: md5.Sum issue

I am trying to manipulate aws sqs on a http://www.nitrous.io box with golang version go1.1.1 linux/amd64.
When I import the sqs module from this github repository https://github.com/crowdmob/goamz/tree/master/sqs and I run my code with a
go run myCode.go
I face this issue:
# github.com/crowdmob/goamz/sqs
../src/github.com/crowdmob/goamz/sqs/md5.go:57: undefined: md5.Sum
My call for that module is like this:
import "github.com/crowdmob/goamz/sqs"
And I can use other modules from the same repo. for example the aws and the S3 one
import "github.com/crowdmob/goamz/aws"
import "github.com/crowdmob/goamz/s3"
Looking at the error in the /sqs/md5.go from the goamz repository I can see the function Sum and it seems the import are done well:
package sqs
import (
"crypto/md5"
"encoding/binary"
"sort"
)
So I am a bit clueless on what's happening. Any Idea?
You're using an old version of Go -- md5.Sum didn't exist in go1.1.1.
Update to go1.3
Did you performed the testing files ? It could come from this, refering to the build state as said chendesheng