-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
74 lines (64 loc) · 2.37 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
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var CopyWebpackPlugin = require('copy-webpack-plugin');
var resolveBowerPath = function(componentPath) {
return path.join(__dirname, 'bower_components', componentPath);
};
module.exports = {
resolve: {
alias:{
jquery: resolveBowerPath('/jquery/dist/jquery.js'),
underscore: resolveBowerPath('/underscore/underscore.js'),
backbone: resolveBowerPath('/backbone/backbone.js'),
'bootstrap-sass': resolveBowerPath('/bootstrap-sass/assets/javascripts/bootstrap.js'),
moment: resolveBowerPath('/moment/moment.js'),
'eonasdan-bootstrap-datetimepicker': resolveBowerPath('/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js'),
'oauth-js': resolveBowerPath('/oauth-js/dist/oauth.js'),
'bootstrap-validator': resolveBowerPath('/bootstrap-validator/js/validator.js'),
handlebars: resolveBowerPath('/handlebars/handlebars.js')
},
root: [
path.resolve('./node_modules'),
path.resolve('./bower_components'),
],
moduleDirectories: ['bower_components']
},
entry: [
'webpack-dev-server/client?http://localhost:3002',
'webpack/hot/only-dev-server',
'./app/scripts/main.js'
],
output: {
path: __dirname + '/dist/',
filename: 'bundle.js',
publicPath: '/dist/'
},
module: {
loaders: [
// HTML
{ test: /\.html$/, loader: 'html' },
// FONTS
{ test: /\.(woff|woff2|ttf|eot|svg|otf)$/, loader: 'url', query: {limit: '1048576'} },
// FILES:
{ test: /\.(jpe?g|jpg|png|gif)$/, loader: 'file'},
// SASS
{test: /\.scss/, loader: ExtractTextPlugin.extract("style-loader","css-loader",'sass-loader','postcss-loader') },
// BABEL: JS|JSX
{ test: /\.(js|jsx)$/, loaders: ['react-hot','babel?presets[]=es2015,presets[]=stage-2,presets[]=react'], include: path.join(__dirname,'app') , exclude: /(node_modules|bower_components)/}
]
},
postcss: function () {
return [require('autoprefixer'), require('precss')];
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new ExtractTextPlugin('[name].css', { allChunks: true }),
new CopyWebpackPlugin([
{from: 'app/index.html', to: 'dist/index.html'}
])
],
sassLoader: {
includePaths: [path.resolve(__dirname, "./app/styles")]
}
}