Skip to content

Commit

Permalink
fix: more inclusive config syntax error hanlding for Node 12.x
Browse files Browse the repository at this point in the history
close #2050
  • Loading branch information
yyx990803 committed Feb 17, 2021
1 parent ab8a55e commit 27785f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,9 +678,11 @@ export async function loadConfigFromFile(
const ignored = new RegExp(
[
`Cannot use import statement`,
`Unexpected token 'export'`,
`Must use import to load ES Module`,
`Unexpected identifier` // #1635 Node <= 12.4 has no esm detection
// #1635, #2050 some Node 12.x versions don't have esm detection
// so it throws normal syntax errors when encountering esm syntax
`Unexpected token`,
`Unexpected identifier`
].join('|')
)
if (!ignored.test(e.message)) {
Expand Down

0 comments on commit 27785f7

Please sign in to comment.