-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
executable file
·59 lines (55 loc) · 1.68 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
/*eslint-env node*/
var path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var webpack = require("webpack");
module.exports = {
context: path.join(__dirname, "src"),
entry: ["./"],
output: {
path: path.join(__dirname, "dist"),
publicPath: process.env.NODE_ENV === "production" ? "http://jamiecrisman.github.io/konbini/" : "/",
filename: process.env.NODE_ENV === "production" ? "bundle-[hash].js" : "bundle.js"
},
plugins: [
new HtmlWebpackPlugin({
title: "KONBINI・コンビニ・Japanese Language Learning Resource Directory",
template: "./src/index.html", // Load a custom template
inject: "body" //scripts are injected to here
}),
new webpack.ProvidePlugin({
fetch: "imports?this=>global!exports?global.fetch!whatwg-fetch"
}),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify(process.env.NODE_ENV || "development"),
APP_ENV: JSON.stringify(process.env.APP_ENV || "development")
}
})
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loaders: process.env.NODE_ENV === "production" ? [
"babel"
] : [
"react-hot",
"babel"
]
},
{
test: /\.scss$/,
loaders: ["style", "css", "sass"]
},
{
test: /\.css$/,
loaders: ["style", "css"]
},
{ test: /\.(woff|woff2)$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
{ test: /\.ttf$/, loader: "file-loader" },
{ test: /\.eot$/, loader: "file-loader" },
{ test: /\.svg$/, loader: "file-loader" }
]
}
};