Created
November 21, 2015 10:19
-
-
Save nojaf/daf886031072b572bc9a to your computer and use it in GitHub Desktop.
From TypeScript to Babel to ES5 with webpack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "webpack-ts-babel", | |
"version": "1.0.0", | |
"description": "", | |
"main": "webpack.config.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"babel-core": "^6.2.1", | |
"babel-loader": "^6.2.0", | |
"babel-preset-es2015": "^6.1.18", | |
"ts-loader": "^0.7.1", | |
"typescript": "^1.6.2", | |
"webpack": "^1.12.6" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"compilerOptions": { | |
"target": "ES6" | |
}, | |
"files": [ | |
"app.ts", | |
"util.ts" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
entry: "./app.ts", | |
output: { | |
filename: "bundle.js" | |
}, | |
module: { | |
loaders: [ | |
// note that babel-loader is configured to run after ts-loader | |
{ test: /\.ts(x?)$/, loader: "babel-loader?presets[]=es2015!ts-loader" } | |
] | |
}, | |
resolve: { | |
extensions: ["", ".webpack.js", ".web.js", ".ts", ".js"] | |
} | |
} |
thanks for sharing, it was very helpful :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
loader: "babel-loader?presets[]=es2015!ts-loader"
This line should be part of the official ts-loader documentation. Thanks :-)