Skip to content

Commit

Permalink
Add support for upcoming TypeScript 1.7 and 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
denvned committed Oct 18, 2015
1 parent ef11a1b commit 4474358
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
TypeScript Loader for *webpack*
===============================

*webpack-typescript* is a lightweight TypeScript loader for *webpack* allowing you to pack multiple modules written in TypeScript into a bundle. It supports TypeScript 1.6, which among other things have introduced support for React JSX. TypeScript 1.5 is also supported.
*webpack-typescript* is a lightweight, cleanly designed TypeScript loader for *webpack* allowing you to pack multiple modules written in TypeScript into a bundle. It supports TypeScript 1.5, 1.6, and experimentally supports [nightly builds](http://blogs.msdn.com/b/typescript/archive/2015/07/27/introducing-typescript-nightlies.aspx) of upcoming TypeScript 1.7 and 1.8.

Installation
------------
Expand All @@ -10,6 +10,10 @@ To install *webpack-typescript* run the following command in your project direct

npm install webpack-typescript --save-dev

And if you want to use a nightly build of TypeScript, also install *typescript@next* before or after installing *webpack-typescript*:

npm install typescript@next --save-dev

Configuration
-------------

Expand Down Expand Up @@ -40,8 +44,10 @@ module.exports = {

### Compiler Options

TypeScript compiler options can be supplied by the standard [tsconfig.json](https://github.com/Microsoft/TypeScript/wiki/tsconfig.json) file. Note that the `"files"` and `"exclude"` sections are ignored, because now *webpack* decides what to compile.
TypeScript compiler options can be supplied by a standard [tsconfig.json](https://github.com/Microsoft/TypeScript/wiki/tsconfig.json) file. Note that the `"files"` and `"exclude"` sections are ignored, because now *webpack* decides what to compile. Likewise, the loader ignores the options `"out"`, `"outDir"`, and `"rootDir"`.

*webpack-typescript* uses the same algorithm to find *tsconfig.json* as TypeScript compiler uses itself, i.e. first look in the current working directory, then in ancestor directories until it is found.

**Important note:** When using *webpack-typescript*, it is most logical to set `"target"` to `"ES5"`, and `"module"` to `"commonjs"`, but it should be also possible to target ES6 and pipe output to [babel-loader](https://github.com/babel/babel-loader), for example.
**Important note:** When using *webpack-typescript*, it is most logical to set `"target"` to `"ES5"` (or `"ES6"` with nightly builds, or the upcoming TypeScript 1.7), and `"module"` to `"commonjs"`, but it should be also possible to target ES6 and pipe output to [babel-loader](https://github.com/babel/babel-loader), for example.

**If you have an question, a bug report, or a feature request, don't hesitate to post an issue in [the issue tracker](https://github.com/denvned/webpack-typescript/issues).**
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "webpack-typescript",
"version": "0.5.4",
"version": "0.5.5",
"author": "Denis Nedelyaev",
"license": "MIT",
"description": "Lightweight TypeScript Loader for webpack.",
"description": "Lightweight, cleanly designed TypeScript Loader for webpack.",
"keywords": [
"typescript-loader",
"ts-loader",
Expand All @@ -23,7 +23,7 @@
},
"main": "lib/index.js",
"peerDependencies": {
"typescript": "^1.5.3"
"typescript": "^1.5.3 || >1.7.0-dev || >1.8.0-dev"
},
"devDependencies": {
"typescript": "^1.6.2"
Expand Down
4 changes: 2 additions & 2 deletions src/OptionsBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default class OptionsBuilder {
constructor(public diagnostics: Diagnostics) {}

addConfigFileText(filePath: string, content: string) {
const result = ts.parseConfigFileText(filePath, content);
const result = (ts.parseConfigFileText || (<any>ts).parseConfigFileTextToJson)(filePath, content);
if (result.error) {
this.diagnostics.add([result.error]);
} else {
Expand All @@ -29,7 +29,7 @@ export default class OptionsBuilder {

function parseOptions() {
config.files = [];
const result = ts.parseConfigFile(config, ts.sys, basePath);
const result = (ts.parseConfigFile || (<any>ts).parseJsonConfigFileContent)(config, ts.sys, basePath);

if (result.errors.length > 0) {
this.diagnostics.add(result.errors);
Expand Down

0 comments on commit 4474358

Please sign in to comment.