-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
87 lines (85 loc) · 2.56 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
var path = require('path');
var webpack = require('webpack');
var ROOT_PATH = path.resolve(__dirname);
var APP_PATH = path.resolve(ROOT_PATH, 'app');
var BUILD_PATH = path.resolve(ROOT_PATH, 'build');
var HtmlWebpackPlugin = require('html-webpack-plugin');
const Jarvis = require('webpack-jarvis');
module.exports = {
devtool: 'source-map',
entry: [
'webpack/hot/only-dev-server',
// path.resolve(__dirname, './app/index.js'),
"./index.js"
],
output: {
path: BUILD_PATH,
// path: path.resolve(__dirname, './build'),
filename: '[name].[hash].js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
query:
{
presets: ['react', 'es2015', 'stage-0']
}
}, {
test: /\.(scss|css)$/,
// exclude: /node_modules/,
loaders: ['style-loader', 'css-loader', 'sass-loader']
//include: APP_PATH
},
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
{
test: /\.(png|jpg)$/,
exclude: /node_modules/,
loader: 'url-loader?limit=40000'
}, {
test: /\.json$/,
loader: "json-loader"
}, {
test: /\.svg/, loader: 'svg-sprite-loader',
},
]
},
resolve: {
extensions: ['.web.js', '.js', '.json'],
},
devServer: {
hot: true,
inline: true,
host:'171.168.1.44',
// host:'localhost',
port: 8415
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
}),
new HtmlWebpackPlugin({ //����ģ�����css/js����������HTML
filename: 'index.html', //���ɵ�html���·��������� path
template: 'index.html', //htmlģ��·��
inject: 'body',
hash: true,
}),
new webpack.DefinePlugin({//production生产环境development开发环境
"process.env": {
NODE_ENV: JSON.stringify("development")
}
}),
new Jarvis({
port: 1337 // optional: set a port
})
],
externals: {
'BMap': 'BMap'
},
};