Skip to content

Instantly share code, notes, and snippets.

@torryt
Created May 28, 2017 11:15
Show Gist options
  • Save torryt/39256ef58f6a7e4104ef67bd6d7324cd to your computer and use it in GitHub Desktop.
Save torryt/39256ef58f6a7e4104ef67bd6d7324cd to your computer and use it in GitHub Desktop.
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const config = {
entry: {
app: './app/index.tsx',
styles: './app/style/main.less',
},
output: {
path: '/dist',
filename: '[name].js',
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'awesome-typescript-loader'
},
{
test: /\.less$|\.css$/,
use: ['style-loader', 'css-loader', 'less-loader'],
},
{
test: /\.js$/,
enforce: 'pre',
loader: 'source-map-loader'
},
{
test: /\.tsx?$/,
enforce: 'pre',
loader: 'tslint-loader',
options:
{
configFile: 'tslint.json'
}
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js'],
},
plugins: [
new HtmlWebpackPlugin({
template: 'index.template.ejs',
inject: 'body',
favicon: 'favicon.ico',
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.LoaderOptionsPlugin({
debug: true
}),
],
devtool: 'source-map',
devServer: {
inline: true,
hot: true,
stats: 'errors-only',
port: 5000,
proxy: {
'/config': 'http://localhost:3000',
},
},
};
module.exports = config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment