webpack.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /**
  2. * @author oldj
  3. * @blog http://oldj.net
  4. */
  5. 'use strict'
  6. const path = require('path')
  7. const webpack = require('webpack')
  8. module.exports = {
  9. entry: './src/ui/index.js',
  10. devtool: 'source-map',
  11. output: {
  12. path: path.join(__dirname, 'src')
  13. , filename: 'bundle.js'
  14. , sourceMapFilename: 'bundle.js.map'
  15. },
  16. resolve: {
  17. extensions: ['.js', '.jsx']
  18. },
  19. module: {
  20. rules: [
  21. {
  22. test: /\.jsx?$/,
  23. exclude: [/node_modules/],
  24. use: ['babel-loader?presets[]=react,presets[]=latest']
  25. }, {
  26. test: /\.less$/,
  27. use: ['style-loader', 'css-loader', 'less-loader']
  28. }, {
  29. test: /\.css$/,
  30. use: ['style-loader', 'css-loader']
  31. }, {
  32. test: /\.(eot|woff|woff2|ttf|svg|png|jpg)$/,
  33. use: 'url-loader?limit=30000&name=[name]-[hash].[ext]'
  34. }
  35. ]//,
  36. // query: {
  37. // presets: ['es2015', 'stage-0', 'react']
  38. // }
  39. , noParse: [/renderer\/Agent/]
  40. },
  41. plugins: [
  42. new webpack.DefinePlugin({
  43. 'process.env': {
  44. NODE_ENV: JSON.stringify('production')
  45. }
  46. })
  47. //, new webpack.optimize.UglifyJsPlugin({
  48. // sourceMap: true,
  49. // compress: {
  50. // warnings: false
  51. // , drop_console: false
  52. // }
  53. // , output: {
  54. // comments: false
  55. // }
  56. //})
  57. , new webpack.IgnorePlugin(new RegExp('^(electron|fs|path)$'))
  58. ]
  59. }