I'm using webpack, babel and few custom loaders (that can handle ES6):
(still es6)
file_es6.js --> my-loaders ----------> babel --> es5
Now I want to use a typescript loader, and here's where problems started.
I thought that ts-loader
will just do type checking and output code stripped of types (code which my loaders can handle). Unfortunately, ts-loader
also compiles the code, which I don't want at his step:
(compiled junk)
file_es6.ts --> ts-loader --------------> my-loaders --> babel
Is there a way to completely disable compilation or do I need to rewrite my loaders so they can handle typescript syntax?
I tried to work around it by setting "target": "ESNext"
(tsconfig.json) but it still changes code a little bit (and adds "helpers" to the beginning of the code):
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import React from 'react';
import { bindActionCreators } from 'redux';
import styled from 'styled-components';