Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension list formatting #122

Closed
timorthi opened this issue Mar 5, 2021 · 1 comment
Closed

Extension list formatting #122

timorthi opened this issue Mar 5, 2021 · 1 comment

Comments

@timorthi
Copy link

timorthi commented Mar 5, 2021

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.

STRML added a commit that referenced this issue Mar 5, 2021
@STRML STRML closed this as completed in 5b86fc6 Mar 5, 2021
@STRML
Copy link
Collaborator

STRML commented Mar 5, 2021

Thanks @timorthi. This was an unintended regression. I've published 7.4.1 which both returns the default extensions and trims any input extensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants