summaryrefslogtreecommitdiff
path: root/lib/internal/modules
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2019-06-17 10:00:31 +0200
committerMichaël Zasso <targos@protonmail.com>2019-09-19 08:48:17 +0200
commit91d99ce41c221c7da1ea29e6c839eb90bedd138d (patch)
tree5e9f8bea75377d4caa3eff7fa7cf646ffd35d2ea /lib/internal/modules
parent027dcff20759143095e7d28144879008936ad568 (diff)
downloadnode-new-91d99ce41c221c7da1ea29e6c839eb90bedd138d.tar.gz
lib,test: fix error message check after V8 update
Backport-PR-URL: https://github.com/nodejs/node/pull/29241 PR-URL: https://github.com/nodejs/node/pull/28918 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'lib/internal/modules')
-rw-r--r--lib/internal/modules/cjs/loader.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index b09e3cceb5..a002efa175 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -97,7 +97,7 @@ function enrichCJSError(err) {
usage. However, some cases are not matching, cases like import statement
after a comment block and/or after a variable definition.
*/
- if (err.message.startsWith('Unexpected token export') ||
+ if (err.message.startsWith('Unexpected token \'export\'') ||
(/^\s*import(?=[ {'"*])\s*(?![ (])/).test(lineWithErr)) {
process.emitWarning(
'To load an ES module, set "type": "module" in the package.json or use ' +