Closed JanMP closed 3 years ago
Hi @JanMP. Please do check whether the newest version works. I guess this problem got fixed in v3.5.4 (actually v3.5.3, but it's an incorrect release).
No, it doesn't. I updated from 3.5.1. to 3.5.5. Things broke and then I went back and forth and narrowed it down to starting at 3.5.2
OK, it makes sense. We'll look into that soon.
Hi @JanMP, thanks for pointing this out as it appears that we've introduced a regression. We're investigating and we'll keep you posted once we find something.
I thought about it a little bit more and I'd say that we have to decide, whether we publish actual ES6 class
es or not. Overall, there's no point in es5
/es6
builds and we should rather have a cjs
/esm
separation, just like other packages. The only question is what EcmaScript standard are we going to use for the build.
ES6 seems a valid choice, as it's already supported by all supported platforms. And if someone's bundler is down-leveling class
es, then it's up to the user to downlevel them in our bundle as well.
What do you think?
@kestarumper In order to make sure that it'll work without problems in all major platforms, i.e., CRA, Gatsby, Meteor, please od check whether the es6
build works in all of them. If it does, then I think we have our winner here.
just to add some information: 3.5.2 also breaks in nextjs (tried actually with 3.5.5). 3.5.1 works though
@kestarumper Could you post your status here? I know you've checked something already.
A few facts from my side.
uniforms/esm
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx"
},
"include": [
"src"
]
}
uniforms/es5
Right now I'm performing further tests on what might be the issue, and I'm trying to find a common solution.
I artificially forced your reproduction to use uniforms/es6
and it works correctly.
I also checked create-react-app
and gatsby
if they work correctly, and I managed to make all three work (no application code changes) with the
// node_modules/uniforms/package.json
...
"main": "./es5/index.js",
"module": "./es6/index.js",
...
I'll probably also try Next.js and if it will work then I'll create a PR to set those main
and module
to es5
and es6
builds.
In the end, we created two builds targeting ES6 with CommonJS modules and ES6 modules. More on that in #1028.
With Meteor 2.5.2 and Uniforms 3.7.0 everything works fine in the browser, but I get the error with Cordova (output from ios, android does not work either).
2022-01-03 11:55:29.911453+0100 sdui-dev[11709:11582136] Uncaught Error: TypeError: Cannot call a class constructor without |new|:79731:http://localhost:12400/__cordova/packages/modules.js?hash=9e468c6d60c3f11da1c3669c0b0c444db669c463
2022-01-03 11:55:29.912947+0100 sdui-dev[11709:11582136] ERROR: The above error occurred in the <AutoValidatedQuickUnstyledForm> component:
in AutoValidatedQuickUnstyledForm (created by FormTest)
in div (created by FormTest)
Hi @JanMP, sorry for the late response. As we're not using Codova ourselves anymore, we'd need a reproduction to confirm and fix that. Please do file a new issue with a reproduction.
After updating I get the same error as #703
I only changed some of the fields. AutoForm is untouched. Renaming _ to something else did not help.
Repro is here: https://github.com/JanMP/repro-uniforms-3.5.2-error (see two commits for changes that lead to problem)