UNPKG

1.7 kBJavaScriptView Raw
1const webpack = require('webpack');
2const path = require('path');
3const autoprefixer = require('autoprefixer');
4const HtmlWebpackPlugin = require('html-webpack-plugin');
5
6const APP = path.join(__dirname, 'dev');
7const BUILD = path.join(__dirname, 'lib');
8const HOST = process.env.HOST || '0.0.0.0';
9const PORT = process.env.PORT || 8081;
10
11module.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?$/, // Match both .js and .jsx files
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 // hot: true,
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