Skip to content

Commit

Permalink
fix: bump js parser ecmaVersion option to 'latest', fix #5013 (#5021)
Browse files Browse the repository at this point in the history
  • Loading branch information
ygj6 committed Sep 22, 2021
1 parent 2fb2561 commit 3541ebc
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = defineConfig({
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
ecmaVersion: 'latest'
},
rules: {
eqeqeq: ['warn', 'always', { null: 'never' }],
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/importAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ function transformCjsImport(
): string | undefined {
const node = (
parseJS(importExp, {
ecmaVersion: 2020,
ecmaVersion: 'latest',
sourceType: 'module'
}) as any
).body[0] as Node
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/pluginContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export async function createPluginContainer(
parse(code: string, opts: any = {}) {
return parser.parse(code, {
sourceType: 'module',
ecmaVersion: 2020,
ecmaVersion: 'latest',
locations: true,
...opts
})
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/ssr/ssrTransform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function ssrTransform(

const ast = parser.parse(code, {
sourceType: 'module',
ecmaVersion: 2021,
ecmaVersion: 'latest',
locations: true
}) as any

Expand Down

0 comments on commit 3541ebc

Please sign in to comment.