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
Use es2019 in vite config #1553
Conversation
@@ -14,6 +14,7 @@ export default defineConfig({ | |||
emptyOutDir: false, | |||
minify: isProduction ? 'esbuild' : false, | |||
sourcemap: false, | |||
target: 'es2019', // portal-ui cannot handle the nullish coalescing output by ESNext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a reversion? i don't know enough about es
versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what you mean by reversion - the Vite docs say the default target
is 'modules' which is effectively es2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So it is going backwards in a way but it should not have an effect on the functionality.
I think it is possible that perhaps there will be new syntax in future es
targets that we would not want to be transpiled away / might not be possible to use under an earlier target
. For this reason, we should still track the status of the portal-ui bundling setup to potentially remove or bump the target
in the future, and we can let the portal-ui developers know
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm fine with that. As long as they know. I'm sure upgrading to v5 would have benefits.
I think this is the last fix that we should get in for the release, at least pending anything new we discover upon testing with portal-ui during testing once it is merged into main / the release PR #1548 |
Discovered while testing the release PR v3.0.0 with portal-ui
Background
In testing the release PR v3.0.0 with portal-ui i ran into this issue that the current Vitessce bundle contains nullish coalescing syntax which the
portal-ui
webpack config does not support (though modern browsers do). I could not figure out a way to update the portal's webpack/babel/browserslist configs to make it work, so i think for now the easiest workaround is for us to stick to outputting ES2019 JS in Vitessce until the portal updates its bundling infrastructure.I thought i might be able to get babel (in portal-ui) to transform the code https://babeljs.io/docs/babel-plugin-transform-nullish-coalescing-operator but that didnt seem to work, even when opting node_modules/vitessce out of the babel-loader exclusion list. These issues that suggest webpack 4 is not compatible with nullish coalescing:
With the changes in this PR, it resolves the error:
Once resolved, we should also make an issue to track this here or in portal-ui repo to be able to remove this build target restriction at some point in the future
Change List
build.target
in Vite configs (more details: https://vitejs.dev/config/build-options.html#build-target, https://esbuild.github.io/content-types/#javascript)Checklist
vitessce-python
andvitessce-r
if this is a release PR