This repository has been archived by the owner on Aug 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
57 lines (55 loc) · 1.65 KB
/
webpack.config.js
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
var webpack = require("webpack");
var path = require("path")
var ExtractTextPlugin = require("extract-text-webpack-plugin")
var ManifestPlugin = require("webpack-manifest-plugin");
var ChunkManifestPlugin = require("chunk-manifest-webpack-plugin");
var HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: './app.ts',
output: {
path: path.join(__dirname, 'build'),
filename: '[name].[chunkhash].js',
chunkFilename: '[name].[chunkhash].js'
},
// Turn on sourcemaps
devtool: 'source-map',
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js', '.html']
},
// Add minification
plugins: [
//new webpack.optimize.UglifyJsPlugin()
new ExtractTextPlugin("bundle.css"),
new webpack.optimize.CommonsChunkPlugin({
name: "vendor",
minChunks: Infinity,
}),
new ManifestPlugin(),
new ChunkManifestPlugin({
filename: "chunk-manifest.json",
manifestVariable: "webpackManifest"
}),
new webpack.optimize.OccurenceOrderPlugin(),
new HtmlWebpackPlugin({title: "WebMusic", template: "index.ejs"})
],
module: {
loaders: [
{ test: /\.tsx?$/, loader: 'ts' },
{ test: /\.css$/, loader: "style-loader!css-loader" },
{
// for some modules like foundation
test: /\.scss$/,
exclude: [/node_modules/], // sassLoader will include node_modules explicitly
loader: ExtractTextPlugin.extract("style", "css!postcss!sass?outputStyle=expanded")
}
]
},
sassLoader: {
includePaths: [path.resolve(__dirname, "node_modules")]
},
devServer: {
historyApiFallback: {
index: 'index.html'
}
}
}