Using parse through CDN or npm install parse@version works
I get the following error ReferenceError: regeneratorRuntime is not defined
If I try to run get the bleeding edge in a node project
npm install parse-community/Parse-SDK-JS.git#master --save
or
build it myself and copy parse.min.js from the dist folder into a simple html file.
I don't know much about babel to fix the issue
Also have this issue, did you find a solution?
I haven't you can try playing around with babel to see if you can get it to work
Facing the same issue with [email protected]
https://github.com/parse-community/Parse-SDK-JS/blob/master/gulpfile.js#L18 specifies @babel/plugin-transform-runtime configuration option:
regenerator: false
That instructs babel to transpile async functions into a code that assumes existence of globally defined regeneratorRuntime.
When you start to use the SDK in a project that does not define a global regeneratorRuntime you'll bump into the exception.
There are some workarounds, but appropriate solution highly depends on your project's specific configuration>
regeneratorRuntimeimport regeneratorRuntime from 'regenerator-runtime/runtime';
window.regeneratorRuntime = regeneratorRuntime;
Use babel to try and inject the polyfill
Use @babel/polyfill together with @babel/preset-env + customize the option useBuildIns to inject required polyfills. That's quite tricky, though and very implicit.
If there's no specific reason to use this option here, I would suggest to set it to true. That will cause babel to use @babel/runtime/regenerator instead of a global variable, which is much easier to set up (as described in generatorAliasing)
Why does this error appear? Everything was working fine to me last week and now I have this issue too.
Same here - I uninstalled [email protected] and installed [email protected] --exact and it's back to normal
Revert to 2.1.0 is the workaround for now.
For newbies to the Parse JS SDK (like me) I reverted to the 2.1.0 level of the parse.min.js script by retrieving it from:
https://npmcdn.com/[email protected]/dist/parse.min.js
placed it in a local js directory and updated the script tag to refer to it instead of the npmcdn server.
Most helpful comment
Facing the same issue with [email protected]
https://github.com/parse-community/Parse-SDK-JS/blob/master/gulpfile.js#L18 specifies
@babel/plugin-transform-runtimeconfiguration option:That instructs babel to transpile
asyncfunctions into a code that assumes existence of globally definedregeneratorRuntime.When you start to use the SDK in a project that does not define a global
regeneratorRuntimeyou'll bump into the exception.Workarounds
There are some workarounds, but appropriate solution highly depends on your project's specific configuration>
regeneratorRuntimeUse https://www.npmjs.com/package/regenerator-runtime and make sure the following code is executed before Parse is initialized:
Use babel to try and inject the polyfill
Use
@babel/polyfilltogether with@babel/preset-env+ customize the optionuseBuildInsto inject required polyfills. That's quite tricky, though and very implicit.Use
[email protected]For maintainers
If there's no specific reason to use this option here, I would suggest to set it to
true. That will cause babel to use@babel/runtime/regeneratorinstead of a global variable, which is much easier to set up (as described ingeneratorAliasing)