Skip to content

Instantly share code, notes, and snippets.

@nojaf
Created November 21, 2015 10:19
Show Gist options
  • Save nojaf/daf886031072b572bc9a to your computer and use it in GitHub Desktop.
Save nojaf/daf886031072b572bc9a to your computer and use it in GitHub Desktop.
From TypeScript to Babel to ES5 with webpack
{
"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"
}
}
{
"compilerOptions": {
"target": "ES6"
},
"files": [
"app.ts",
"util.ts"
]
}
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"]
}
}
@ccpu
Copy link

ccpu commented Jul 27, 2018

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