1 | var path = require('path');
|
2 | var webpack = require('webpack');
|
3 | var HtmlWebpackPlugin = require('html-webpack-plugin');
|
4 | var host = "localhost";
|
5 | var port = "8088";
|
6 |
|
7 |
|
8 | module.exports = {
|
9 | host: host,
|
10 | port: port,
|
11 | resolve: {
|
12 | root: path.resolve(__dirname, 'page/src'),
|
13 | extensions: ['', '.js', '.jsx']
|
14 | },
|
15 | entry: {
|
16 | main: [
|
17 | 'webpack-dev-server/client?http://' + host + ':' + port,
|
18 | 'webpack/hot/only-dev-server',
|
19 | path.resolve(__dirname, 'page/src/main')
|
20 | ],
|
21 | },
|
22 | devtool: 'cheap-source-map',
|
23 | output: {
|
24 | path: path.join(__dirname, 'build'),
|
25 | filename: '[name].js',
|
26 | chunkFilename: "[id].chunk.js",
|
27 | publicPath: '',
|
28 | },
|
29 | plugins: [
|
30 |
|
31 | new webpack.HotModuleReplacementPlugin(),
|
32 | new webpack.NoErrorsPlugin(),
|
33 | new webpack.optimize.DedupePlugin(),
|
34 | new HtmlWebpackPlugin({
|
35 | filename: 'index.html',
|
36 | template: path.join(__dirname, 'page/src/index.html'),
|
37 | chunks: ['main'],
|
38 | inject: true
|
39 | })
|
40 | ],
|
41 | module: {
|
42 | loaders: [
|
43 | {
|
44 | test: /\.jsx?$/,
|
45 | loader: 'babel',
|
46 | include: [
|
47 |
|
48 | path.join(process.cwd(), 'page/src'),
|
49 | ],
|
50 | },
|
51 | {
|
52 | test: /\.css$/,
|
53 |
|
54 | loader: 'style-loader!css-loader!less-loader'
|
55 | },
|
56 | {
|
57 | test: /\.less$/,
|
58 |
|
59 | loader: 'style-loader!css-loader!less-loader'
|
60 | },
|
61 | {
|
62 | test: /\.(png|jpg|gif|svg)$/,
|
63 |
|
64 | loader: 'url-loader?limit=2048&name=images/[hash:8].[name].[ext]'
|
65 | }
|
66 | ]
|
67 | }
|
68 | };
|