github.com/humaniq/go-ethereum@v1.6.8-0.20171225131628-061223a13848/dashboard/assets/webpack.config.js (about)

     1  // Copyright 2017 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  const webpack = require('webpack');
    18  const path = require('path');
    19  
    20  module.exports = {
    21  	resolve: {
    22  		extensions: ['.js', '.jsx'],
    23  	},
    24  	entry:  './index',
    25  	output: {
    26  		path:     path.resolve(__dirname, 'public'),
    27  		filename: 'bundle.js',
    28  	},
    29  	plugins: [
    30  		new webpack.optimize.UglifyJsPlugin({
    31  			comments: false,
    32  			mangle:   false,
    33  			beautify: true,
    34  		}),
    35  	],
    36  	module: {
    37  		rules: [
    38  			{
    39  				test:    /\.jsx$/, // regexp for JSX files
    40  				exclude: /node_modules/,
    41  				use:     [ // order: from bottom to top
    42  					{
    43  						loader:  'babel-loader',
    44  						options: {
    45  							plugins: [ // order: from top to bottom
    46  								// 'transform-decorators-legacy', // @withStyles, @withTheme
    47  								'transform-class-properties', // static defaultProps
    48  								'transform-flow-strip-types',
    49  							],
    50  							presets: [ // order: from bottom to top
    51  								'env',
    52  								'react',
    53  								'stage-0',
    54  							],
    55  						},
    56  					},
    57  					// 'eslint-loader', // show errors not only in the editor, but also in the console
    58  				],
    59  			},
    60  			{
    61  				test: /font-awesome\.css$/,
    62  				use:  [
    63  					'style-loader',
    64  					'css-loader',
    65  					path.resolve(__dirname, './fa-only-woff-loader.js'),
    66  				],
    67  			},
    68  			{
    69  				test: /\.woff2?$/, // font-awesome icons
    70  				use:  'url-loader',
    71  			},
    72  		],
    73  	},
    74  };