Replies: 5 comments 1 reply
-
Related issue |
Beta Was this translation helpful? Give feedback.
-
Thanks for finding the root cause, @Alvinn8! I'm running into that same issue. In particular, like in #2810, I'm trying to use the recommended snowpack webpack plugin to bundle my snowpack output, but webpack 4 doesn't support optional chaining: webpack/webpack#10227 (comment) |
Beta Was this translation helpful? Give feedback.
-
I have this exact same use case - with the optional chaining operator. This can't be fixed even when using @snowpack/plugin-typescript. It looks like it's meant to only make type checks and runs |
Beta Was this translation helpful? Give feedback.
-
I think the TS use-case is common enough where it would make sense to have some sort of built-in support where it tries to read the |
Beta Was this translation helpful? Give feedback.
-
Version 0.12.4 of esbuild will respect the |
Beta Was this translation helpful? Give feedback.
-
I'm making a project that uses typescript and snowpack. In typescript I'm using some modern features like optional chaining (
nullable?.something
). This feature is now available in native javascript as of ES2020, but that is still a very new feature and I would like typescript to transpile it to an older version, as for instance my phone doesn't yet support ES2020 and I don't wanna have to load a babel-transpiled legacy bundle just because it doesn't support the latest of latest of features. TypeScript has support for this in their tsconfig.json, it's thetarget
setting, which I have set toES2017
. But esbuild ignores that setting and instead uses their own target setting (docs). In the plugin-esbuild.ts esbuild is being called with quite few options. Maybe make an option inside the snowpack config which is copied over, just like it's done with sourcemap.target: config.buildOptions.target
or something like that. Or read the tsconfig.json file, get the value there, and use that value as the esbuild target (you might need to convert it to lowercase though).I tried this locally by changing the code in the index.lib.js and added a line that said
target: "es2017"
and it works brilliantly. I would like that as an option somewhere, or gotten from the tsconfig.json so we can control that.Beta Was this translation helpful? Give feedback.
All reactions