-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
70 lines (63 loc) · 1.82 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
70
var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var CopyWebpackPlugin = require("copy-webpack-plugin");
var path = require("path");
var DEV = process.env.NODE_ENV === "development"
var cssLoaderOptions = "?modules";
var plugins = [];
plugins.push(new webpack.DefinePlugin({
__DEV__: DEV,
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV || "development")
}));
plugins.push(new HtmlWebpackPlugin({
title: "Postal.js Publication Visualizer",
filename: "index.html",
template: "./src/index.tpl"
}))
if (DEV) {
plugins.push(new webpack.SourceMapDevToolPlugin());
cssLoaderOptions += "&localIdentName=[local]_[hash:base64:5]"
}
plugins.push(new CopyWebpackPlugin([
{ from: "src/manifest.json"},
{ from: "src/contentscript.js" },
{ from: "src/bridge.js" },
{ from: "src/devtools.html" },
{ from: "src/devtools.js" },
{ from: "src/background.js" },
{ from: "src/icon.png" }
]))
module.exports = {
entry: "./src/index.js",
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
}, {
test: /node_modules\/react-calendar-timeline.*\.js$/,
loader: "babel-loader"
}, {
test: /\.css$/,
loader: "style-loader!css-loader" + cssLoaderOptions
}, {
test: /\.(png|woff|woff2|eot|ttf|svg).*$/,
loader: "url-loader?limit=1000000"
}, {
test: /\.less$/,
exclude: /node_modules\/react-tabs/,
loader: "style-loader!css-loader" + cssLoaderOptions + "!less-loader"
}, {
test: /node_modules\/react-tabs.*\.less$/,
loader: "style-loader!css-loader!less-loader"
}, {
test: /\.scss$/,
loader: "style-loader!css-loader!sass-loader"
}]
},
output: {
path: __dirname + "/build",
filename: "[name].[chunkhash].js"
},
plugins: plugins
};