-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config-dev.js
More file actions
123 lines (101 loc) · 3.79 KB
/
webpack.config-dev.js
File metadata and controls
123 lines (101 loc) · 3.79 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
let Webpack = require("webpack");
export default {
// Compilation target http://webpack.github.io/docs/configuration.html#target
target: "web",
// Debug mode http://webpack.github.io/docs/configuration.html#debug
debug: true,
// Enhance debugging http://webpack.github.io/docs/configuration.html#devtool
devtool: "source-map",
// Capture timing information http://webpack.github.io/docs/configuration.html#profile
profile: true,
// Entry files http://webpack.github.io/docs/configuration.html#entry
entry: {
main: "./frontend/app-react", // TODO other pages ?!
},
// Output files http://webpack.github.io/docs/configuration.html#output
output: {
path: __dirname + "/public",
publicPath: "http://localhost:2992/public/",
filename: "[name].js",
chunkFilename: "[id].js", // TODO need?
sourceMapFilename: "debugging/[file].map",
libraryTarget: undefined,
pathinfo: true,
},
// Module http://webpack.github.io/docs/configuration.html#module
module: {
loaders: [ // http://webpack.github.io/docs/loaders.html
// JS
{test: /\.(js(\?.*)?)$/, loaders: ["react-hot", "babel"], exclude: /node_modules/ }, // ?stage=2 ????
// JSON
{test: /\.(json(\?.*)?)$/, loaders: ["json"]},
{test: /\.(json5(\?.*)?)$/, loaders: ["json5"]},
// RAW
{test: /\.(txt(\?.*)?)$/, loaders: ["raw"]},
// URL
{test: /\.(jpg(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(jpeg(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(png(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(gif(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(svg(\?.*)?)$/, loaders: ["url?limit=10000"]},
{test: /\.(woff(\?.*)?)$/, loaders: ["url?limit=100000"]},
{test: /\.(woff2(\?.*)?)$/, loaders: ["url?limit=100000"]},
// FILE
{test: /\.(ttf(\?.*)?)$/, loaders: ["file"]},
{test: /\.(eot(\?.*)?)$/, loaders: ["file"]},
{test: /\.(wav(\?.*)?)$/, loaders: ["file"]},
{test: /\.(mp3(\?.*)?)$/, loaders: ["file"]},
// HTML
{test: /\.(html(\?.*)?)$/, loaders: ["html"]},
// MARKDOWN
{test: /\.(md(\?.*)?)$/, loaders: ["html", "markdown"]},
// CSS
{test: /\.(css(\?.*)?)$/, loaders: ["style", "css"]},
// LESS
{test: /\.(less(\?.*)?)$/, loaders: ["style", "css", "less"]},
],
},
// Module resolving http://webpack.github.io/docs/configuration.html#resolve
resolve: {
// Abs. path with modules
root: __dirname + "/frontend",
// node_modules and like that
modulesDirectories: ["web_modules", "node_modules"],
},
// Loader resolving http://webpack.github.io/docs/configuration.html#resolveloader
resolveLoader: {
// Abs. path with loaders
root: __dirname + "/node_modules",
alias: {},
},
// Keep bundle dependencies http://webpack.github.io/docs/configuration.html#externals
externals: [],
// Plugins http://webpack.github.io/docs/list-of-plugins.html
plugins: [
function () {
this.plugin("done", function (stats) {
let jsonStats = stats.toJson({
chunkModules: true,
exclude: [
/node_modules[\\\/]react(-router)?[\\\/]/,
/node_modules[\\\/]items-store[\\\/]/
]
});
jsonStats.publicPath = "http://localhost:2992/public/";
require("fs").writeFileSync(__dirname + "/public/stats.json", JSON.stringify(jsonStats));
});
},
//new Webpack.PrefetchPlugin("react"),
//new Webpack.PrefetchPlugin("react/lib/ReactComponentBrowserEnvironment"),
],
// CLI mirror http://webpack.github.io/docs/configuration.html#devserver
devServer: {
stats: {
cached: false,
exclude: [
/node_modules[\\\/]react(-router)?[\\\/]/,
/node_modules[\\\/]items-store[\\\/]/
]
}
}
};