-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
106 lines (101 loc) · 2.75 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
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
var path = require("path");
var appPaths = require("./root.js").paths;
var HtmlWebpackPlugin = require ("html-webpack-plugin");
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var webpack = require('webpack');
module.exports = {
devServer: {
inline: true
},
entry: {
app: ["babel-polyfill", path.resolve(appPaths.rootDir, "app", "index.js") ]
},
output: {
path: path.resolve(__dirname, "build"),
filename: "app.bundle.js"
},
module: {
rules: [
{ test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" },
{
test: /\.css$/,
use: [{
loader: "style-loader",
}, {
loader: "css-loader",
}],
},
{
test: /\.less$/,
use: [{
loader: "style-loader",
}, {
loader: "css-loader",
}, {
loader: "less-loader",
}],
},
{ test: /\.json/, loader: 'json-loader' },
{
test: /EffectComposer\.js/,
loader: "expose-loader?THREE!imports-loader?this=>global!exports-loader?THREE",
},
{
test: /RenderPass\.js/,
loader: "expose-loader?THREE!imports-loader?this=>global!exports-loader?THREE",
},
{
test: /CopyShader\.js/,
loader: "expose-loader?THREE!imports-loader?this=>global!exports-loader?THREE",
},
{
test: /ConvolutionShader\.js/,
loader: "expose-loader?THREE!imports-loader?this=>global!exports-loader?THREE",
},
{
test: /BloomPass\.js/,
loader: "expose-loader?THREE!imports-loader?this=>global!exports-loader?THREE",
},
{
test: /ShaderPass\.js/,
loader: "expose-loader?THREE!imports-loader?this=>global!exports-loader?THREE",
},
{
test: /TexturePass\.js/,
loader: "expose-loader?THREE!imports-loader?this=>global!exports-loader?THREE",
},
{
test: /RGBShiftShader\.js/,
loader: "expose-loader?THREE!imports-loader?this=>global!exports-loader?THREE",
},
]
},
resolveLoader: {
modules: ["node_modules"],
extensions: [".js"],
},
resolve: {
extensions: [".js", ".json"],
alias: {
app: path.join(appPaths.appSrcDir),
}
},
plugins: [
// makes THREE available in the global scope anywhere in the app
new webpack.ProvidePlugin({
THREE: "three"
}),
// makes TWEEN available in the global scope anywhere in the app
new webpack.ProvidePlugin({
TWEEN: "tween.js",
}),
new HtmlWebpackPlugin({
chunks: ['app', 'devServer'],
template: path.join(appPaths.appDir, "example.template.html"),
filename: 'index.html'
}),
new ExtractTextPlugin('[name].bundle.css', {
allChunks: true
})
]
};