Created
November 20, 2017 12:55
-
-
Save merss19/e1f698540a3f2bad0c8031d5b3d640b2 to your computer and use it in GitHub Desktop.
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
var webpack = require("webpack") | |
var HtmlWebpackPlugin = require("html-webpack-plugin") | |
var path = require("path") | |
module.exports = { | |
entry: [ | |
"react-hot-loader/patch", | |
"webpack-dev-server/client?http://localhost:8100", | |
__dirname + "/src/index.tsx", | |
__dirname + "/src/assets/sass/styles.scss" | |
], | |
output: { | |
filename: "bundle.js", | |
path: __dirname + "dist", | |
publicPath: "/" | |
}, | |
devtool: "source-map", | |
// devtool: 'eval', | |
module: { | |
rules: [ | |
{ | |
test: /\.ts$/, | |
loader: "tslint-loader", | |
include: [path.join(__dirname, "/")], | |
exclude: /(node_modules)/, | |
enforce: "pre" | |
}, | |
{ | |
test: /\.scss$/, | |
include: [path.join(__dirname, "/"), path.join(__dirname, "/assets")], | |
loader: "style-loader!css-loader!sass-loader" | |
}, | |
{ | |
test: /(\.ts|\.tsx)$/, | |
include: [path.join(__dirname, "/src")], | |
loader: ["react-hot-loader/webpack", "awesome-typescript-loader"] | |
}, | |
{ | |
test: /\.(woff|woff2|eot|ttf|svg)$/, | |
use: "file-loader?name=[path][name].[ext]" | |
}, | |
{ | |
enforce: "pre", | |
test: /\.js$/, | |
loader: ["source-map-loader"] | |
} | |
] | |
}, | |
resolve: { | |
extensions: [".js", ".jsx", ".tsx", ".ts"], | |
alias: { | |
"components": path.resolve(__dirname, "./src/components") | |
} | |
}, | |
plugins: [ | |
new HtmlWebpackPlugin({ | |
template: "./src/index.html", | |
hash: true, | |
minify: { | |
removeComments: true, | |
collapseWhitespace: true, | |
removeRedundantAttributes: true, | |
useShortDoctype: true, | |
removeEmptyAttributes: true, | |
removeStyleLinkTypeAttributes: true, | |
keepClosingSlash: true, | |
minifyJS: true, | |
minifyCSS: true, | |
minifyURLs: true | |
} | |
}), | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.NamedModulesPlugin(), | |
new webpack.NoEmitOnErrorsPlugin() | |
], | |
devServer: { | |
port: 8100, | |
hot: true, | |
publicPath: "/", | |
historyApiFallback: true, | |
host: "localhost", | |
inline: true | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment