target optiontsconfig.json
{
"compilerOptions": {
"target": "es2017",
"module": "es2015",
"moduleResolution": "node",
"lib": [
"es2017",
"dom"
],
"declaration": true,
"sourceMap": true,
"inlineSources": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"outDir": "./",
// Only necessary because @types/uglify-js can't find types for source-map
"skipLibCheck": true,
"baseUrl": "."
},
"include": [
"custom_typings/**/*.ts",
"src/**/*.ts"
],
"exclude": []
}
parcel should respect option in tsconfig
parcel does not respect option in tsconfig
I am trying to test lit-html and lit-element with typescript which requires some es2017 target
index.ts
import {LitElement} from "@polymer/lit-element";
import {TemplateResult, html} from "lit-html";
export class App extends LitElement {
protected _render(_props: object): TemplateResult {
return html`
<style>
.red { color: red; }
</style>
<div class='red'>hello App</div>
`;
}
}
customElements.define('my-element', App)
index.html
<html>
<body>
<script src="./index.ts"></script>
</body>
</html>
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | latest
| Node | 8
| npm/Yarn | npm
| Operating System | mac
Please fill in the bug report entirely, the config field is also there for tsconfigs...
@DeMoorJasper , I updated and provided more info. Please let me know if anything else is needed.
most of the config file is overwritten by parcel, as we can't respect things like output directory in tsconfig. (It might conflict with other code and is probably unwanted behaviour anyways).
For target, babel-preset-env gets run over every asset parcel processes, to ensure browser or node compatibility. (Especially for node modules).
There is a similar issue that requests for this to be removed, but there has been a huge discussion about this at the beginning of parcel and this seemed like the best solution at the time.
You can configure browsers field in package.json to something more modern, to have ES2017. See parcels docs: https://en.parceljs.org/transforms.html#default-babel-transforms
I'm not sure it changed in the past year, but the link provided by @DeMoorJasper has zero information about target browsers.
@ranisalt Seems like that paragraph was moved: https://en.parceljs.org/javascript.html#default-babel-transforms
Most helpful comment
most of the config file is overwritten by parcel, as we can't respect things like output directory in tsconfig. (It might conflict with other code and is probably unwanted behaviour anyways).
For target, babel-preset-env gets run over every asset parcel processes, to ensure browser or node compatibility. (Especially for node modules).
There is a similar issue that requests for this to be removed, but there has been a huge discussion about this at the beginning of parcel and this seemed like the best solution at the time.
You can configure browsers field in package.json to something more modern, to have ES2017. See parcels docs: https://en.parceljs.org/transforms.html#default-babel-transforms