Last active
June 30, 2019 10:10
-
-
Save asci/9fe5ec7b7c0840ba042501027f21f080 to your computer and use it in GitHub Desktop.
React TS kit 2019
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 @types/react @types/react-dom html-webpack-plugin ts-loader typescript webpack webpack-cli webpack-dev-server --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
Show hidden characters
{ | |
"compilerOptions": { | |
"allowJs": false, | |
"allowSyntheticDefaultImports": true, | |
"declaration": true, | |
"declarationDir": "./dist", | |
"forceConsistentCasingInFileNames": true, | |
"jsx": "react", | |
"lib": ["es6", "dom", "es2016", "es2017"], | |
"module": "esnext", | |
"moduleResolution": "node", | |
"noFallthroughCasesInSwitch": true, | |
"noImplicitAny": false, | |
"noImplicitReturns": true, | |
"noImplicitThis": true, | |
"noUnusedLocals": true, | |
"outDir": "./dist", | |
"skipLibCheck": true, | |
"sourceMap": true, | |
"strictNullChecks": true, | |
"suppressImplicitAnyIndexErrors": true, | |
"target": "es5" | |
}, | |
"include": ["src"], | |
"exclude": ["node_modules", "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
const path = require('path'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
mode: 'development', | |
devtool: 'inline-source-map', | |
devServer: { | |
contentBase: path.join(__dirname, 'dist'), | |
index: 'index.html', | |
port: 9000, | |
open: true, | |
}, | |
entry: './src/index.tsx', | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
filename: 'bundle.js', | |
}, | |
resolve: { | |
// Add '.ts' and '.tsx' as resolvable extensions. | |
extensions: ['.ts', '.tsx', '.js'], | |
}, | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
title: 'Development', | |
template: 'src/index.html', | |
}), | |
], | |
module: { | |
noParse: /__tests__|test/, | |
rules: [ | |
{ | |
test: /\.ts(x?)$/, | |
exclude: /node_modules/, | |
use: [ | |
{ | |
loader: 'ts-loader', | |
options: { onlyCompileBundledFiles: true }, | |
}, | |
], | |
}, | |
], | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment