This repository has been archived by the owner on Jun 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
91 lines (83 loc) · 2.36 KB
/
webpack.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
var webpack = require("webpack");
var path = require("path");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var BrowserSyncPlugin = require("browser-sync-webpack-plugin");
var ProgressBarPlugin = require("progress-bar-webpack-plugin");
var CopyWebpackPlugin = require("copy-webpack-plugin");
var bourbon = require("bourbon").includePaths;
var neat = require("bourbon-neat").includePaths;
var stylepaths = bourbon.concat(neat);
const atl = require("awesome-typescript-loader");
const extractSass = new ExtractTextPlugin({filename: "app.css"});
module.exports = {
resolve: {
alias: {
moment: "moment/moment.js",
},
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".ts", ".tsx", ".js", ".svg", ".scss"]
},
mode: "development",
plugins: [
new ProgressBarPlugin(),
extractSass,
new HtmlWebpackPlugin({
title: "Thomas Constantine Moore",
inject: "body",
hash: true,
template: "src/index.html"
}),
new BrowserSyncPlugin({
// browse to http://localhost:3000/ during development,
// ./public directory is being served
host: "localhost",
port: 5000,
server: { baseDir: ["public"] }
}),
new CopyWebpackPlugin([
{ from: "src/static" }
]),
],
entry: ["./src/client/app.ts"],
output: {
path: __dirname + "/public/",
filename: "bundle.js"
},
devtool: "source-map",
module: {
rules: [
{
test: /\.(ts|tsx)?$/, // All ts and tsx files will be process by
loaders: [ "awesome-typescript-loader" ],
exclude: /node_modules/ // ignore node_modules
},
{ test: /\.jpg$/, loader: "url-loader?limit=10000&minetype=image/jpg" },
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
use: [{
loader: "css-loader"
}, {
loader: "sass-loader",
options: {
includePaths: stylepaths
}
}]
})
},
{
test: /\.(eot|ttf|woff|woff2)$/,
loader: "file-loader?name=fonts/[name].[ext]"
},
{
test: /\.svg$/,
loader: "svg-as-symbol-loader?tag=svg"
},
]
},
devServer: {
historyApiFallback: true,
hot: true
}
};