forked from mossplix/tunga-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·60 lines (58 loc) · 2.4 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
'use strict';
var webpack = require('webpack'),
path = require('path'),
srcPath = path.join(__dirname, 'src'),
OpenBrowserPlugin = require('open-browser-webpack-plugin'),
common_config = require('./webpack.common.config');
module.exports = {
target: 'web',
cache: true,
entry: {
vendor: ['babel-polyfill', 'react', 'react-dom', 'react-router', 'redux', 'react-redux'],
app: path.join(srcPath, 'app.js')
},
output: {
path: path.join(__dirname, 'build'),
publicPath: '/',
filename: '[name].js?v='+ common_config.hash,
library: ['[name]'],
pathInfo: true
},
module: {
loaders: [
{ test: /\.coffee$/, loader: 'coffee-loader' },
{ test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel?cacheDirectory'},
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
{ test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader' },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.(png|jpg|gif)(\?.*)?$/, loader: 'url-loader?limit=8192&name=images/[hash].[ext]?v='+ common_config.hash+'!image-maxsize?max-width=1600'},
{ test: /\.woff(2)?(\?v=[0-9].[0-9].[0-9])?$/, loader: "url-loader?mimetype=application/font-woff&name=fonts/[hash].[ext]" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9].[0-9].[0-9])?$/, loader: "file-loader?name=fonts/[hash].[ext]" },
{ test: /\.ejs$/, loader: 'ejs-compiled?htmlmin' },
{ test: /\.mp4$/, loader: 'file-loader?name=videos/[hash].[ext]?v='+ common_config.hash},
{ test: /\.(mp3|wav)$/, loader: 'file-loader?name=audio/[hash].[ext]?v='+ common_config.hash}
]
},
resolve: {
root: srcPath,
extensions: ['', '.js', '.jsx', '.json', '.coffee', '.less', '.css', '.png', '.jpg', '.gif'],
modulesDirectories: ['node_modules', 'src']
},
plugins: [
common_config.plugins.chunkVendorPlugin,
common_config.plugins.HTMLInjectPlugin,
common_config.plugins.noErrorsPlugin,
new OpenBrowserPlugin({}),
common_config.plugins.magicGlobalsPlugin,
new webpack.HotModuleReplacementPlugin()
],
debug: true,
devtool: 'source-map',
devServer: {
contentBase: './build',
historyApiFallback: true,
hot: true,
inline: true,
progress: true
}
};