Skip to content

Instantly share code, notes, and snippets.

@foxbunny
Last active August 19, 2017 09:00
Show Gist options
  • Save foxbunny/aca6f074e4eb86d4906afb12b7816c37 to your computer and use it in GitHub Desktop.
Save foxbunny/aca6f074e4eb86d4906afb12b7816c37 to your computer and use it in GitHub Desktop.
Bare-bones webpack 2 configuration for typescript projects
/**
* (c) 2017 Hajime Yamasaki Vukelic
* Some rights reserved.
*
* yarn add -D webpack webpack-dev-server ts-node ts-loader html-webpack-plugin @types/webpack @types/html-webpack-plugin
*/
import path = require("path");
import HTMLWebpackPlugin = require("html-webpack-plugin");
import webpack = require("webpack");
export default function(env: object | void) {
return {
entry: "./src/index.ts",
module: {
rules: [
{
test: /.tsx?$/,
use: "ts-loader",
},
],
},
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "build"),
},
plugins: [
new HTMLWebpackPlugin(),
],
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment