S
SolidJS

support

Converting code to ES5

SSeventimes<37/28/2023
Hello! I need to convert my code to ES5 format and I faced such a problem that const and let variables remain in the assembled project, I expected that all variables will be converted to var, but this did not happen. This is what the assembled project looks like (1 image), I'm not sure, but almost all const and let variables were created by SolidJS This is what my Babel Loader looks like: const babelLoader = { test: /.(js|jsx|ts|tsx)$/, exclude: [options.paths.corejs], use: { loader: 'babel-loader', options: { babelrc: false, configFile: false, sourceType: 'unambiguous', presets: [ [ '@babel/preset-env', { targets: { samsung: '4', }, useBuiltIns: 'usage', corejs: '3.27', }, ], 'solid', '@babel/preset-typescript', ], plugins: getBabelPlugins(options.isDev), }, }, }; getBabelPlugins(options.isDev) returns: [ '@babel/plugin-syntax-dynamic-import', '@babel/plugin-proposal-class-properties', '@babel/plugin-proposal-object-rest-spread', '@babel/plugin-transform-block-scoping' ] My main question comes up is how can I convert const variables and let them into var within SolidJS itself? P.S. I need this because I have to support 2013 browsers. I will be glad for any hint, thanks for your attention πŸ™‚
BSBirk Skyum7/28/2023
I'm not so strong at Babel, but if you use typescript you can set the target to es5, and that does remove the let/const
TTrader1017/28/2023
I'm curious for your use case because tbh I really don't see why you need es5
SSeventimes<37/28/2023
Can you please elaborate on what target you are talking about?
BSBirk Skyum7/28/2023
TSConfig Reference - Docs on every TSConfig option
From allowJs to useDefineForClassFields the TSConfig reference includes information about all of the active compiler flags setting up a TypeScript project.
TTrader1017/28/2023
I mean why do you need to polyfill es6 ?
SSeventimes<37/28/2023
I need this because I need to support very old TVs, unfortunately you can’t update the browser on them
TTrader1017/28/2023
ok interesting makes sense then. It's just that in 2023 there really is no need to polyfill es6 for normal usage
SSeventimes<37/28/2023
Unfortunately :(, this did not help me, I think that the problem appears at the moment when the "jsxTransform" occurs and it just creates all these const and let variables
Bbigmistqke7/28/2023
I wonder if mb the order of the presets matter? From https://github.com/babel/babel/issues/4882 :
Plugins run before Presets.
Plugin ordering is first to last.
Preset ordering is reversed (last to first).
Plugins run before Presets.
Plugin ordering is first to last.
Preset ordering is reversed (last to first).
GitHub
plugins/presets order Β· Issue #4882 Β· babel/babel
In documentation it is written: Plugins run before Presets. Plugin ordering is first to last. Preset ordering is reversed (last to first). I wrote my own plugin which works with const and let. It w...
NNesCafe7/29/2023
sometimes it can happen. for example for apps I develop at work in our organization there are very old machines. some running win XP and no way to install latest browsers there. though (with firefox) they support part of modern JS api, like let and Map, Set but it thowed me errors for something I made with Vue (I guess shadowRoot. I just defined some object to window to suppress those. because none of my components use that feature, it is just Vue internals have checks)

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
pass session via `<Outlet />`Is it possible to pass session to outlet like this? It doesn't seem to work. I'm using solid-start aEasiest way to spin up an e2e/integration-test setup with solid-start?Hey folks, I am currently trying to figure out what would be a good way to build an integration anContainer onFocus to observe to subelement focus?Trying the following, but the handler doesn't seem to be fired when a sidebar item is tab focused uscan't reset createInfiniteScrollhello, at our team we are trying to create infinite scrolling with filters with @solid-primitives/paHelp integrating microfuzz search library with solidI want to integrate this library into my component https://github.com/Nozbe/microfuzz I have this createResource doesn't rerun when passed store changesAm I using this correctly? Ryan said it should work when wrapped in a function: https://github.com/React Icons ErrorReact icons is not rendering on the UI please i need helpsolid-eslint warning about event handlersSo, I get the `eslintsolid/reactivity` warning when I use reactive props in event handlers: > This fScroll & Drag Solid DNDHi, do you know the best way to manage scroll (auto) when using solid dnd? Especially as I have theHow can this incredibly simple piece of code lead to "Maximum call stack size exceeded" ?The entire code for this demo is here: https://playground.solidjs.com/anonymous/7ec72a47-1bb4-4e9f-bHow to protect all routes other than sign-inHi there, I am making an app where I only want signed-in users to see the content, I want all routesTypeError: Cannot read properties of undefined (reading 'remove') at reconcileArraysI get this during a `refetch()` call of a resource. Pretty hard to debug and see what actually getsValidating a field based on promise values min and max with yup and react form handlerconst schemaReference = (res) => { console.log(res); return yup.object({ unit: yup.strReaching into nested properties and keeping them reactive?Coming from React I really like that I can destruct nested props into single variables, in this examTesting difficulties in solid-startI'm running into some perplexing errors with Vitest in my SSR-enabled Solid Start app. In the importReactSVG like component in SolidHey, I recently was remaking my portfolio website in astro with some solid.js. I wanted to make an iSuspense not updating when navigating to Route directlyHey folks, I am currently having a weird issue I can't quite solve: We have a route which receivesHow do you do logging errors etc. In solid start?Like how do you get logs you can browse for instance in a web interface when solid start app is runnwarnings when passing onClick as propI get a warning in the child component when I pass an event handler from the parent. In the parenRoutes are being duplicated when HMR is onIt seems whenever the file updates the route is not actually refreshed and it just adds the updated