github.com/oskarth/go-ethereum@v1.6.8-0.20191013093314-dac24a9d3494/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, ''),
    27  		filename: 'bundle.js',
    28  	},
    29  	plugins: [
    30  		new webpack.optimize.UglifyJsPlugin({
    31  			comments: false,
    32  			mangle:   false,
    33  			beautify: true,
    34  		}),
    35  		new webpack.DefinePlugin({
    36  			PROD: process.env.NODE_ENV === 'production',
    37  		}),
    38  	],
    39  	module: {
    40  		rules: [
    41  			{
    42  				test:    /\.jsx$/, // regexp for JSX files
    43  				exclude: /node_modules/,
    44  				use:     [ // order: from bottom to top
    45  					{
    46  						loader:  'babel-loader',
    47  						options: {
    48  							plugins: [ // order: from top to bottom
    49  								// 'transform-decorators-legacy', // @withStyles, @withTheme
    50  								'transform-class-properties', // static defaultProps
    51  								'transform-flow-strip-types',
    52  							],
    53  							presets: [ // order: from bottom to top
    54  								'env',
    55  								'react',
    56  								'stage-0',
    57  							],
    58  						},
    59  					},
    60  					// 'eslint-loader', // show errors not only in the editor, but also in the console
    61  				],
    62  			},
    63  			{
    64  				test: /font-awesome\.css$/,
    65  				use:  [
    66  					'style-loader',
    67  					'css-loader',
    68  					path.resolve(__dirname, './fa-only-woff-loader.js'),
    69  				],
    70  			},
    71  			{
    72  				test: /\.woff2?$/, // font-awesome icons
    73  				use:  'url-loader',
    74  			},
    75  		],
    76  	},
    77  };