Created
February 18, 2020 06:21
-
-
Save DearVikki/d95bf0a6b16aee4ea00cf355609c116c to your computer and use it in GitHub Desktop.
typescript webpack init
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
yarn add webpack webpack-dev-server typescript ts-loader | |
yarn add webpack-cli --dev |
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
// Add this | |
"scripts": { | |
"start": "webpack-dev-server --mode development" | |
}, |
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
const path = require('path'); | |
module.exports = { | |
entry: './src/code.ts', | |
devtool: 'inline-source-map', | |
module: { | |
rules: [ | |
{ | |
test: /\.tsx?$/, | |
use: 'ts-loader', | |
exclude: /node_modules/ | |
} | |
] | |
}, | |
resolve: { | |
extensions: [ '.ts', '.js', '.tsx' ] | |
}, | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist') | |
} | |
}; |
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": { | |
"outDir": "./dist/", | |
"noImplicitAny": true, | |
"module": "es6", | |
"moduleResolution": "node", | |
"sourceMap": true, | |
"target": "es6", | |
"typeRoots": [ | |
"node_modules/@types" | |
], | |
"lib": [ | |
"es2017", | |
"dom" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment