-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firefox 34 Syntax Error #15
Comments
ohhh.... old browser version... |
Found a possible cause: I use Parcel as our bundler, and the order they're use are Means that the resolver will use a not-bundled version of package ( i18next-http-backend/package.json Line 17 in 9c6a73b
which using a ES6+ syntax. That's very different from the which use a bundled version of package: import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
import _createClass from '@babel/runtime/helpers/esm/createClass';
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
import _typeof from '@babel/runtime/helpers/esm/typeof';
var arr = [];
var each = arr.forEach;
var slice = arr.slice;
function defaults(obj) {
each.call(slice.call(arguments, 1), function (source) {
if (source) {
for (var prop in source) {
if (obj[prop] === undefined) obj[prop] = source[prop];
}
}
});
return obj;
} There's a solution to solve this problem: use a https://parceljs.org/module_resolution.html#package.json-%60browser%60-field I suggest to provide a migration notes in document for replacing the deprecated |
A little question: Is your parcel setup not babeling the files? (I've never used parcel) |
AFAIK the current stable version (v1) of Parcel doesn't have the option to include some of the package should be compiled, which means we should assume that all packages in Another approach to solve this issue is to import the import Backend from 'i18next-http-backend/cjs'; |
Ok, didn't know Parcel is not able to transpile it... ok... |
Unfortunately after some clean up and test, I found the solution from above not work anymore, even if I use import Backend from 'i18next-http-backend/i18nextHttpBackend'; I think it might not to use any because I got this new message:
I'll go back to use |
@fynncfchen if you create a reproducable example I can try to help. |
I found it's hard to reproduce by myself also, sorry..... |
This is my playground: https://github.com/adrai/parcel-example-i18next-http-backend |
Good news! I finally can reproduce what I've got! |
This is because you’re importing like: import Backend from "i18next-http-backend"; |
If you need a transpiled source (seems by default for parcel this is the case), you need to import /cjs |
I'm not sure what happened but after I deleted |
In your example: https://github.com/fynncfchen/i18next-http-backend-issue |
I know, when I importing |
I found that |
fyi: With the latest version importing with |
🐛 Bug Report
Firefox 34 got syntax error, the file compiled by Babel are not use older syntax.
Compiled file:
To Reproduce
i18next-xhr-backend
for the first time withi18n.js
i18next-http-backend
Expected behavior
Use both
i18next-xhr-backend
andi18next-http-backend
should be work fine.Your Environment
package.json
.babelrc
.browserslistrc
The text was updated successfully, but these errors were encountered: