-
-
Save nobitagit/66d1181999e8cf53903630764986ccb9 to your computer and use it in GitHub Desktop.
From TypeScript to Babel to ES5 with webpack
This file contains hidden or 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 hidden or 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
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "ES6" | |
}, | |
"files": [ | |
"app.ts", | |
"util.ts" | |
] | |
} |
This file contains hidden or 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"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment