webpack.config.js 2.1 KB

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