-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
69 lines (62 loc) · 1.73 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
57
58
59
60
61
62
63
64
65
66
67
68
69
var webpack = require("webpack"),
path = require("path"),
fileSystem = require("fs"),
// Separates CSS into a separate file.
ExtractTextPlugin = require('extract-text-webpack-plugin');
var fileExtensions = ["jpg", "jpeg", "png", "gif", "eot", "otf", "svg", "ttf", "woff", "woff2"];
var options = {
entry: {
options: path.join(__dirname, "index.ts"),
},
// All file outputs from webpack will be under the 'build/' directory.
output: {
path: path.join(__dirname),
filename: "index.bundle.js"
},
module: {
rules: [
{
// Bundles all imported CSS files into one file
test: /\.css$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: {
loader: 'typings-for-css-modules-loader',
options: {
sourceMap: true,
importLoaders: 3,
modules: true,
namedExport: true,
camelCase: true
}
},
}),
exclude: /node_modules/
},
{
// Handles loading images
test: new RegExp('\.(' + fileExtensions.join('|') + ')$'),
loader: "file-loader?name=[name].[ext]",
exclude: /node_modules/
},
{
// Handles compiling TypeScript files into JS
test: /\.tsx?$/,
loader: "ts-loader"
},
{
// Handles compiling React, ES7, ES6
test: /\.jsx?$/,
include: path.join(__dirname, "chrome-extension", "js", "init.js"),
loader: "babel-loader"
}
]
},
plugins: [
new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify('production')
}),
new ExtractTextPlugin("styles.css")
]
};
module.exports = options;