Extension list formatting
timorthi opened this issue · comments
Hi,
I recently experienced a regression after upgrading from v7.0.0 to v7.4.0, where I received the following error without any config change:
/Users/timorthi/.../tcomb/common.js:1
import t from 'tcomb';
^
SyntaxError: Unexpected identifier
My startup command was: babel-watch --inspect --use-polling --extensions '.ts, .js' server
After some digging, I realized that the format in which I wrote out my --extensions
option was incorrect. The only reason why my command worked as I'd expected is that the program.extensions
was being concatenated with babel.DEFAULT_EXTENSIONS
. Meaning, at runtime, my config looked something like
transpileExtensions = [
'.ts', // from --extensions
' .js', // from --extensions
'.js', // from babel defaults
]
The ' .js'
obviously didn't do anything helpful, but the invalid .js
was "saved" by the concatenation of Babel defaults.
This concat was removed in v7.2.0 (line 105):
7b5eee6
and so produced the error above.
This was a pretty subtle error to catch, so I figured I'd bring it up here for anyone who encountered the same issue.
My thoughts are either to 1) bring back the concatenation of Babel defaults (if it's not breaking), 2) trim whitespace in arrayify
, or 3) at least specify in the docs that the --extensions
option should not contain whitespace.
Thanks @timorthi. This was an unintended regression. I've published 7.4.1 which both returns the default extensions and trims any input extensions.