Skip to content

Commit 43b7b78

Browse files
authored
fix(esbuild): transpile with esnext in dev (#10207)
1 parent 0542e7c commit 43b7b78

File tree

5 files changed

+96
-88
lines changed

5 files changed

+96
-88
lines changed

packages/plugin-vue/src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ export async function transformMain(
221221
const { code, map } = await transformWithEsbuild(
222222
resolvedCode,
223223
filename,
224-
{ loader: 'ts', sourcemap: options.sourceMap },
224+
{
225+
loader: 'ts',
226+
target: 'esnext',
227+
sourcemap: options.sourceMap
228+
},
225229
resolvedMap
226230
)
227231
resolvedCode = code

packages/vite/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
},
5959
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
6060
"dependencies": {
61-
"esbuild": "^0.15.6",
61+
"esbuild": "^0.15.9",
6262
"postcss": "^8.4.16",
6363
"resolve": "^1.22.1",
6464
"rollup": "~2.78.0"

packages/vite/src/node/plugins/esbuild.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ export function esbuildPlugin(options: ESBuildOptions = {}): Plugin {
179179
// Remove optimization options for dev as we only need to transpile them,
180180
// and for build as the final optimization is in `buildEsbuildPlugin`
181181
const transformOptions: TransformOptions = {
182+
target: 'esnext',
182183
...options,
183184
minify: false,
184185
minifyIdentifiers: false,

playground/vue/tsconfig.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
// esbuild transpile should ignore this
4+
"target": "ES5"
5+
},
6+
"include": ["src"]
7+
}

0 commit comments

Comments
 (0)