Search code examples
javascripttypescriptbabeljsparceljs

How to fail parcel/babel/typescript proccess on complication errors/warnings?


index.jsx

import React from 'react'
import ReactDOM from 'react-dom'
import Home from "./home";

const x:number = "aaa"
const x:number = "aaa"
const x:number = "aaa"

ReactDOM.render(<Home/>, document.getElementById('root'))

The build should fail due to: multiple identifiers of the same name (js) and invalid type (string to number variable) (ts).

Currently, parcel compiles successfully. How can I enforce a failure in such cases?


Minimal working project-example: https://github.com/stavalfi/learning-parcel-js


Solution

  • Using ts-loader will do the trick.

    Example: https://github.com/stavalfi/lerna-starter