-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.coffee
78 lines (65 loc) · 1.7 KB
/
webpack.config.coffee
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
path = require "path"
webpack = require "webpack"
HtmlWebpackPlugin = require('html-webpack-plugin')
PROD = JSON.parse(process.env.PROD_ENV || '0');
plugins = []
plugins.push new webpack.ProvidePlugin
$: "jquery"
jquery: "jquery"
"windows.jQuery": "jquery"
"THREE": "THREE"
plugins.push new HtmlWebpackPlugin
filename: "index.html"
title: "EGS"
template: 'src/index.hbs'
plugins.push new webpack.optimize.CommonsChunkPlugin "lib", "js/lib.js"
if PROD
plugins.push new webpack.optimize.UglifyJsPlugin
compress:
warnings: false
#plugins.push new webpack.optimize.UglifyJsPlugin
module.exports =
# cache: false,
# debug:true
devtool: 'source-map'
entry:
app: "app"
lib: [
"jquery"
"THREE"
"three-orbit-controls"
"bootstrap-webpack!bootstrap.config.js"
]
output:
path: __dirname
publicPath: ""
filename: "js/[name].js"
# chunkFilename: "[id]_[name]_[hash].js"
externals:
google: 'google'
App: 'app',
window: 'window'
module:
loaders: [
# coffescript
{ test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery' }
{ test: /\.coffee$/, loader: "coffee-loader" }
{ test: /\.hbs$/, loader: "handlebars-loader?inlineRequires=cmp&helperDirs[]=" + __dirname + "/src/_helpers/handlebars" }
]
resolve:
modulesDirectories: [
"node_modules",
"src",
"src/_helpers"
]
extensions: ["", ".js", ".coffee", ".hbs"]
resolveLoader:
modulesDirectories: ["src/_loaders", "node_modules"]
extensions: ["", ".webpack-loader.js", ".web-loader.js", ".loader.js", ".js"]
packageMains: ["webpackLoader", "webLoader", "loader", "main"]
plugins: plugins
devServer:
headers:
"Access-Control-Allow-Origin": "*"
contentBase: "."
# historyApiFallback: true