Snippets for http://fagner.co/2016/01/01/TypeScript-+-Webpack/
Created
January 2, 2016 01:18
-
-
Save fagnercarvalho/5894313be602cbab3367 to your computer and use it in GitHub Desktop.
2016-01-01-TypeScript-+-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
import greeter from './ts/greeter'; | |
import $ = require('jquery'); | |
$(() => { | |
$(document.body).html(greeter("Fagner")); | |
}); |
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
export default function greet(name: string) { | |
return 'Hello ' + name; | |
} |
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
<html> | |
<body> | |
<script src="bundle.js"></script> | |
</body> | |
</html> |
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": { | |
"module": "commonjs", | |
"sourceMap": true | |
}, | |
"files": [ | |
"app.ts", | |
"typings/tsd.d.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' | |
}, | |
devtool: 'source-map', | |
resolve: { | |
extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'] | |
}, | |
module: { | |
loaders: [ | |
{ test: /\.ts$/, loader: 'ts-loader' } | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment