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

Babel overwrites target ecmaVersion of tsconfig #860

Closed
DeMoorJasper opened this issue Feb 20, 2018 · 4 comments
Closed

Babel overwrites target ecmaVersion of tsconfig #860

DeMoorJasper opened this issue Feb 20, 2018 · 4 comments
Labels

Comments

@DeMoorJasper
Copy link
Member

🐛 bug report

🎛 Configuration (.babelrc, package.json, cli command)

tsconfig => es2018
babel => no config

🤔 Expected Behavior

Babel shouldn't transpile down

😯 Current Behavior

Babel does transpile down

💁 Possible Solution

Check if it's already transpiled in JSAsset.parse and just convert to a babel ast if it has been

🔦 Context

See twitter conversation: https://twitter.com/martin_hotell/status/965862279022632961

💻 Code Sample

🌍 Your Environment

Accurs in all parcel versions

@Hotell
Copy link

Hotell commented Feb 20, 2018

Just adding more info:

TS version: 2.7.2

tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "sourceMap": true, 
    "importHelpers": true,
    "pretty": true,
    "skipLibCheck": true,
    "strict": true, 
    "moduleResolution": "node",
    "esModuleInterop": true                     
  }
}

@devongovett
Copy link
Member

In the latest Parcel version, we apply babel-preset-env by default. If you don't specify browser targets, we'll choose a set of default browser targets (> 1% marketshare). This means your code will be transpiled by babel after typescript runs. You can stop this from happening by setting some browser targets for your app in package.json:

{
  "browserslist": ["last 2 Chrome versions"]
}

@dkundel
Copy link

dkundel commented Mar 8, 2018

Is there no way to take a hint from the tsconfig.json if we are bundling TypeScript and configuring babel-present-env according to that information.

Like if there is no .babelrc and no browserslist entry but we are bundling TypeScript check which value is used in target in the config to determine the output.

This seems to be the same issue raised in #954

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.

@github-actions github-actions bot added the Stale Inactive issues label Jan 18, 2020
@github-actions github-actions bot closed this as completed Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants