github.com/alexdevranger/node-1.8.27@v0.0.0-20221128213301-aa5841e41d2d/dashboard/assets/webpack.config.js (about)

     1  // Copyright 2017 The go-ethereum Authors
     2  // This file is part of the go-dubxcoin library.
     3  //
     4  // The go-dubxcoin 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-dubxcoin 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-dubxcoin 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: [
    45            // order: from bottom to top
    46            {
    47              loader: "babel-loader",
    48              options: {
    49                plugins: [
    50                  // order: from top to bottom
    51                  // 'transform-decorators-legacy', // @withStyles, @withTheme
    52                  "transform-class-properties", // static defaultProps
    53                  "transform-flow-strip-types",
    54                ],
    55                presets: [
    56                  // order: from bottom to top
    57                  "env",
    58                  "react",
    59                  "stage-0",
    60                ],
    61              },
    62            },
    63            // 'eslint-loader', // show errors not only in the editor, but also in the console
    64          ],
    65        },
    66        {
    67          test: /font-awesome\.css$/,
    68          use: [
    69            "style-loader",
    70            "css-loader",
    71            path.resolve(__dirname, "./fa-only-woff-loader.js"),
    72          ],
    73        },
    74        {
    75          test: /\.woff2?$/, // font-awesome icons
    76          use: "url-loader",
    77        },
    78      ],
    79    },
    80  };