-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
82 lines (79 loc) · 2.69 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
const path = require('path');
const webpack = require('webpack');
module.exports = {
context: path.join(__dirname, 'public'),
entry: {
webpack: 'webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000',
app: [path.resolve(__dirname, 'public/src/app/app.js'),'webpack-hot-middleware/client?path=/__webpack_hmr'] // entry point location to app
},
resolve: {
root: [__dirname, path.join(__dirname, 'public/src/')],
alias: {
// scalejs
'scalejs.application': path.join(__dirname, 'node_modules/scalejs/dist/scalejs.application.js'),
'scalejs.core': path.join(__dirname, 'node_modules/scalejs/dist/scalejs.core.js'),
'scalejs.sandbox': path.join(__dirname, 'node_modules/scalejs/dist/scalejs.sandbox.js'),
// extensions
'hotRender': path.join(__dirname, 'public/src/hotRender.js'),
'jquery-ui/autocomplete': path.join(__dirname, 'node_modules/jquery-ui/ui/widgets/autocomplete.js')
}
},
output: {
path: __dirname,
publicPath: '/build/',
filename: '[name].bundle.js'
},
module: {
preLoaders: [
{
test: [
/Module\.js$/
],
loader: 'scalejs.hot-loader'
},
{
test: [
path.join(__dirname, 'node_modules/scalejs')
],
loader: 'source-map-loader'
}
],
loaders: [
{
loader: 'babel-loader',
test: [
path.join(__dirname, 'public/src')
],
exclude: /\.html?$/,
query: {
presets: 'es2015',
}
},
{
test: /\.html$/,
loader: 'html-loader'
},
{
test: /\.scss$/,
loader: 'style-loader!css-loader!autoprefixer-loader!sass-loader'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader!autoprefixer-loader',
},
{
test: /\.woff|\.woff2|\.svg|.eot|\.png|\.jpg|\.ttf/,
loader: 'url-loader?prefix=font/&limit=10000'
}
]
},
plugins: [
// Avoid publishing files when compilation fails
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
//new ExtractTextPlugin('main.css') // TODO: move to production config
],
// Create Sourcemaps for the bundle
devtool: 'source-map'
};