Skip to content

Instantly share code, notes, and snippets.

@stepquick
Created October 3, 2018 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stepquick/ffd78fa456ab91a2ccbb787e1e7236ed to your computer and use it in GitHub Desktop.
Save stepquick/ffd78fa456ab91a2ccbb787e1e7236ed to your computer and use it in GitHub Desktop.
sample ts config for webpack dev server
{
"name": "tsconfig",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack-dev-server --config webpack.config.ts"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^10.11.4",
"@types/webpack": "^4.4.14",
"ts-loader": "^5.2.1",
"ts-node": "^7.0.1",
"typescript": "^3.1.1",
"webpack": "^4.20.2",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
}
}
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true
}
}
import * as path from 'path';
module.exports = {
entry: './src/index.ts',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'public/assets'),
publicPath: "/assets",
},
devServer: { inline: true },
devtool: "source-map",
mode: "development"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment