1 | const webpack = require('webpack');
|
2 | const path = require('path');
|
3 | const autoprefixer = require('autoprefixer');
|
4 | const HtmlWebpackPlugin = require('html-webpack-plugin');
|
5 |
|
6 | const APP = path.join(__dirname, 'dev');
|
7 | const BUILD = path.join(__dirname, 'lib');
|
8 | const HOST = process.env.HOST || '0.0.0.0';
|
9 | const PORT = process.env.PORT || 8081;
|
10 |
|
11 | module.exports = {
|
12 | entry: {
|
13 | index: APP,
|
14 | },
|
15 | output: {
|
16 | path: BUILD,
|
17 | filename: '[name].js',
|
18 | publicPath: '/'
|
19 | },
|
20 | resolve: {
|
21 | extensions: ['', '.js', '.jsx', '.css', '.scss'],
|
22 | modulesDirectories: [
|
23 | 'node_modules',
|
24 | path.resolve(__dirname, './node_modules')
|
25 | ]
|
26 | },
|
27 | module: {
|
28 | loaders: [
|
29 | {
|
30 | test: /\.jsx?$/,
|
31 | exclude: /node_modules/,
|
32 | loader: 'babel',
|
33 | query: {
|
34 | presets: ['react', 'es2015', 'stage-0', 'airbnb']
|
35 | }
|
36 | },
|
37 |
|
38 | {test: /\.css$/, loader: "style-loader!css-loader"}
|
39 | ]
|
40 | },
|
41 | devServer: {
|
42 | historyApiFallback: true,
|
43 | inline: true,
|
44 |
|
45 | progress: true,
|
46 | stats: 'errors-only',
|
47 | host: HOST,
|
48 | port: PORT,
|
49 | outputPath: BUILD,
|
50 | },
|
51 | devtool: 'inline-source-map',
|
52 | plugins: [
|
53 | new HtmlWebpackPlugin({
|
54 | template: './dev/template.html',
|
55 | inject: 'body'
|
56 | }),
|
57 | new webpack.DefinePlugin({
|
58 | 'process.env': {
|
59 | 'NODE_ENV': JSON.stringify(process.env.NODE_ENV)
|
60 | }
|
61 | }),
|
62 | new webpack.HotModuleReplacementPlugin(),
|
63 |
|
64 | ]
|
65 | }; |
\ | No newline at end of file |