Skip to content

Commit

Permalink
fix(esbuild): transpile with esnext in dev (#10207)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Sep 23, 2022
1 parent 0542e7c commit 43b7b78
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 88 deletions.
6 changes: 5 additions & 1 deletion packages/plugin-vue/src/main.ts
Expand Up @@ -221,7 +221,11 @@ export async function transformMain(
const { code, map } = await transformWithEsbuild(
resolvedCode,
filename,
{ loader: 'ts', sourcemap: options.sourceMap },
{
loader: 'ts',
target: 'esnext',
sourcemap: options.sourceMap
},
resolvedMap
)
resolvedCode = code
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/package.json
Expand Up @@ -58,7 +58,7 @@
},
"//": "READ CONTRIBUTING.md to understand what to put under deps vs. devDeps!",
"dependencies": {
"esbuild": "^0.15.6",
"esbuild": "^0.15.9",
"postcss": "^8.4.16",
"resolve": "^1.22.1",
"rollup": "~2.78.0"
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/plugins/esbuild.ts
Expand Up @@ -179,6 +179,7 @@ export function esbuildPlugin(options: ESBuildOptions = {}): Plugin {
// Remove optimization options for dev as we only need to transpile them,
// and for build as the final optimization is in `buildEsbuildPlugin`
const transformOptions: TransformOptions = {
target: 'esnext',
...options,
minify: false,
minifyIdentifiers: false,
Expand Down
7 changes: 7 additions & 0 deletions playground/vue/tsconfig.json
@@ -0,0 +1,7 @@
{
"compilerOptions": {
// esbuild transpile should ignore this
"target": "ES5"
},
"include": ["src"]
}

0 comments on commit 43b7b78

Please sign in to comment.