UNPKG

1.29 kBJavaScriptView Raw
1const webpack = require('webpack');
2const path = require('path');
3const buildPath = path.resolve(__dirname, './web/build');
4const nodeModulesPath = path.resolve(__dirname, 'node_modules');
5const config = {
6 // Entry points to the project
7 entry: [
8 path.join(__dirname, './web/src/app/app.jsx'),
9 ],
10 resolve: {
11 extensions: ['', '.js', '.jsx']
12 },
13 watch: true,
14 devtool: 'sourcemap',
15 output: {
16 path: path.resolve(buildPath, "app"), // Path of output file
17 filename: 'app.js',
18 },
19 plugins: [
20 // Enables Hot Modules Replacement
21 new webpack.HotModuleReplacementPlugin(),
22 // Allows error warnings but does not stop compiling.
23 new webpack.NoErrorsPlugin()
24 ],
25 module: {
26 loaders: [{
27 test: /(\.css)$/,
28 loaders: ['style-loader', 'css-loader']
29 },{
30 test: /(\.less)$/,
31 loaders: ['style-loader', 'css-loader', 'less-loader']
32 },{
33 // React-hot loader and
34 test: /(\.jsx|\.js)$/, // All .js files
35 loaders: ['react-hot', 'babel-loader'], // react-hot is like browser sync and babel loads jsx and es6-7
36 exclude: [nodeModulesPath],
37 },{
38 test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
39 loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]'
40 }
41 ]
42 },
43};
44module.exports = config;