e82cf88b7e6544e025d04c5fe607a9beaa9dc372
[pixelated-user-agent.git] / web-ui / webpack.config.js
1 var path = require('path');
2 var webpack = require('webpack');
3 var publicAssetsWebpack = require('./config/public-assets-webpack');
4 var protectedAssetsWebpack = require('./config/protected-assets-webpack');
5 var loaders = require('./config/loaders-webpack');
6 var aliases = require('./config/alias-webpack');
7
8 var commonConfiguration = {
9   node: { fs: 'empty' },
10   devtool: 'source-map',
11   resolve: {
12     alias: aliases,
13     extensions: ['', '.js']
14   },
15   module: {
16     loaders: loaders
17   },
18   postcss: {}
19 };
20
21 var publicAssets = Object.assign({}, commonConfiguration, {
22   entry: {
23     'login': './src/login/login.js',
24     'account_recovery': './src/account_recovery/account_recovery.js'
25   },
26   output: {
27     path: path.join(__dirname, 'dist/public'),
28     filename: '[name].js',
29     publicPath: '/public/'
30   },
31   plugins: [
32     publicAssetsWebpack,
33     new webpack.DefinePlugin({
34       'process.env': {
35         NODE_ENV: JSON.stringify('development')
36       }
37   })]
38 });
39
40 var protectedAssets = Object.assign({}, commonConfiguration, {
41   entry: {
42     'app': './app/js/index.js',
43     'backup_account': './src/backup_account/backup_account.js',
44     'sandbox': './app/js/sandbox.js'
45   },
46   output: {
47     path: path.join(__dirname, 'dist/protected'),
48     filename: '[name].js',
49     publicPath: '/assets/'
50   },
51   plugins: [
52     protectedAssetsWebpack,
53     new webpack.DefinePlugin({
54       'process.env': {
55         NODE_ENV: JSON.stringify('development')
56       }
57   })]
58 });
59
60 module.exports = [publicAssets, protectedAssets];