Last active
April 21, 2019 13:30
-
-
Save hasankoroglu/c53074e4659ea96744f247f376274e14 to your computer and use it in GitHub Desktop.
TypeScript Geliştirme Ortamı Hazırlama
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
import { Person } from "./class"; | |
let kisi:Person = new Person("Hasan","KÖROĞLU"); | |
kisi.displayName(); |
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
export class Person { | |
name:string; | |
lastname:string; | |
constructor(_name:string,_lastname:string) { | |
this.name = _name; | |
this.lastname = _lastname; | |
} | |
displayName = () => document.write(`Hello, my name is ${this.name} ${this.lastname}`); | |
} |
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
│ index.html | |
│ package.json | |
│ tsconfig.json | |
│ webpack.config.js | |
├───dist | |
└───src | |
├───app.ts | |
└───class.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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script src="./dist/bundle.js"></script> | |
</body> | |
</html> |
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": "typescript_webpack_ts-loader_example", | |
"version": "1.0.0", | |
"main": "./dist/bundle.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"web": "webpack-dev-server", | |
"bundle": "webpack" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"ts-loader": "^5.3.3", | |
"typescript": "^3.4.4", | |
"uglifyjs-webpack-plugin": "^2.1.2", | |
"webpack": "^4.30.0", | |
"webpack-cli": "^3.3.0", | |
"webpack-dev-server": "^3.3.1" | |
}, | |
"dependencies": {}, | |
"description": "TypeScript ile beraber webpack ve ts kodlarının webpack için bundle edilmesini sağlayan ts-loader örneği" | |
} |
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
Show hidden characters
{ | |
"compilerOptions": { | |
"module": "commonjs", | |
"target": "es5", | |
"sourceMap": true, | |
"outDir": "./dist/", | |
"noImplicitAny": true | |
}, | |
"exclude": [ | |
"node_modules" | |
], | |
"include": [ | |
"./src/*" | |
] | |
} |
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
const path = require('path'); | |
module.exports = { | |
entry: './src/app.ts', | |
devtool: 'inline-source-map', | |
mode: 'production', | |
module: { | |
rules: [ | |
{ | |
test: /\.ts/, | |
use: ['ts-loader'], | |
exclude: /node_modules/ | |
} | |
] | |
}, | |
resolve: { | |
extensions: [ '.ts', '.tsx', ".js", ".json"] | |
}, | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist') | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment