github.com/arieschain/arieschain@v0.0.0-20191023063405-37c074544356/dashboard/assets/webpack.config.js (about)

     1  const webpack = require('webpack');
     2  const path = require('path');
     3  
     4  module.exports = {
     5  	resolve: {
     6  		extensions: ['.js', '.jsx'],
     7  	},
     8  	entry:  './index',
     9  	output: {
    10  		path:     path.resolve(__dirname, ''),
    11  		filename: 'bundle.js',
    12  	},
    13  	plugins: [
    14  		new webpack.optimize.UglifyJsPlugin({
    15  			comments: false,
    16  			mangle:   false,
    17  			beautify: true,
    18  		}),
    19  		new webpack.DefinePlugin({
    20  			PROD: process.env.NODE_ENV === 'production',
    21  		}),
    22  	],
    23  	module: {
    24  		rules: [
    25  			{
    26  				test:    /\.jsx$/, // regexp for JSX files
    27  				exclude: /node_modules/,
    28  				use:     [ // order: from bottom to top
    29  					{
    30  						loader:  'babel-loader',
    31  						options: {
    32  							plugins: [ // order: from top to bottom
    33  								// 'transform-decorators-legacy', // @withStyles, @withTheme
    34  								'transform-class-properties', // static defaultProps
    35  								'transform-flow-strip-types',
    36  							],
    37  							presets: [ // order: from bottom to top
    38  								'env',
    39  								'react',
    40  								'stage-0',
    41  							],
    42  						},
    43  					},
    44  					// 'eslint-loader', // show errors not only in the editor, but also in the console
    45  				],
    46  			},
    47  			{
    48  				test: /font-awesome\.css$/,
    49  				use:  [
    50  					'style-loader',
    51  					'css-loader',
    52  					path.resolve(__dirname, './fa-only-woff-loader.js'),
    53  				],
    54  			},
    55  			{
    56  				test: /\.woff2?$/, // font-awesome icons
    57  				use:  'url-loader',
    58  			},
    59  		],
    60  	},
    61  };