UNPKG

1.55 kBJavaScriptView Raw
1const webpack = require('webpack');
2const path = require('path');
3const buildPath = path.resolve(__dirname, './web/build');
4const nodeModulesPath = path.resolve(__dirname, 'node_modules');
5console.log(process.env.BABEL_ENV);
6const config = {
7 // Entry points to the project
8 entry: [
9 path.join(__dirname, './web/src/app/app.jsx'),
10 ],
11 resolve: {
12 extensions: ['', '.js', '.jsx']
13 },
14 watch: false,
15 devtool: null,
16 output: {
17 path: path.resolve(buildPath, "app"), // Path of output file
18 filename: 'app.js',
19 },
20 plugins: [
21 new webpack.DefinePlugin({
22 "process.env": {
23 NODE_ENV: JSON.stringify(process.env.NODE_ENV)
24 }
25 }),
26 new webpack.optimize.OccurrenceOrderPlugin(),
27 new webpack.optimize.UglifyJsPlugin({
28 compress: {
29 warnings: false
30 }
31 })
32 ],
33 module: {
34 loaders: [{
35 test: /(\.css)$/,
36 loaders: ['style-loader', 'css-loader']
37 }, {
38 test: /(\.less)$/,
39 loaders: ['style-loader', 'css-loader', 'less-loader']
40 }, {
41 test: /(\.jsx|\.js)$/, // All .js files
42 loader: 'babel',
43 exclude: [nodeModulesPath]
44 }, {
45 test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
46 loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]'
47 }
48 ]
49 },
50};
51module.exports = config;