webpack.config.js 2.0 KB

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