-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
The errors generated by globalize-compiler are pretty cryptic and not useful when it fails to parse a file.
time.js
import Globalize from 'globalize';
/**
* Intl Format a short time string e.g. "9:30 AM" in en-US
*/
export const formatTime = Globalize.dateFormatter({ date: 'short' });globalize-compiler -l en -o en.js time.jsGives the following result:
{...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:5702
throw e;
^
Error: Line 1: Unexpected token
at constructError ({...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:2407:21)
at createError ({...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:2426:17)
at unexpectedTokenError ({...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:2500:13)
at tolerateUnexpectedToken ({...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:2509:21)
at parseStatementListItem ({...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:3973:21)
at parseScriptBody ({...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:5490:25)
at parseProgram ({...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:5506:16)
at Object.parse ({...}/node_modules/globalize-compiler/node_modules/esprima/esprima.js:5690:23)
at Object.extractor [as extract] ({...}/node_modules/globalize-compiler/lib/extract.js:39:17)
at {...}/node_modules/globalize-compiler/bin/globalize-compiler.js:84:27 {
lineNumber: 1,
description: 'Unexpected token',
index: 0
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
In this example it's clear that globalize-compiler doesn't support ES20153. But It doesn't tell you what file the failure is. And if the error was somewhere in the middle of the file it wouldn't necessarily be easy to discover what the issue is.
Metadata
Metadata
Assignees
Labels
No labels