You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.3 KiB

  1. /*
  2. * Isomorphic Javascript library for Minio Browser JSON-RPC API, (C) 2016 Minio, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. var webpack = require('webpack')
  17. var path = require('path')
  18. var CopyWebpackPlugin = require('copy-webpack-plugin')
  19. var purify = require("purifycss-webpack-plugin")
  20. var exports = {
  21. context: __dirname,
  22. entry: [
  23. path.resolve(__dirname, 'app/index.js')
  24. ],
  25. output: {
  26. path: path.resolve(__dirname, 'production'),
  27. filename: 'index_bundle.js'
  28. },
  29. module: {
  30. loaders: [{
  31. test: /\.js$/,
  32. exclude: /(node_modules|bower_components)/,
  33. loader: 'babel',
  34. query: {
  35. presets: ['react', 'es2015']
  36. }
  37. }, {
  38. test: /\.less$/,
  39. loader: 'style!css!less'
  40. }, {
  41. test: /\.json$/,
  42. loader: 'json-loader'
  43. }, {
  44. test: /\.css$/,
  45. loader: 'style!css'
  46. }, {
  47. test: /\.(eot|woff|woff2|ttf|svg|png)/,
  48. loader: 'url'
  49. }]
  50. },
  51. node:{
  52. fs:'empty'
  53. },
  54. plugins: [
  55. new CopyWebpackPlugin([
  56. {from: 'app/css/loader.css'},
  57. {from: 'app/img/favicon.ico'},
  58. {from: 'app/img/browsers/chrome.png'},
  59. {from: 'app/img/browsers/firefox.png'},
  60. {from: 'app/img/browsers/safari.png'},
  61. {from: 'app/img/logo.svg'},
  62. {from: 'app/index.html'}
  63. ]),
  64. new webpack.DefinePlugin({
  65. 'process.env.NODE_ENV': '"production"'
  66. }),
  67. new webpack.ContextReplacementPlugin(/moment[\\\/]locale$/, /^\.\/(en)$/),
  68. new purify({
  69. basePath: __dirname,
  70. paths: [
  71. "app/index.html",
  72. "app/js/*.js"
  73. ]
  74. })
  75. ]
  76. }
  77. if (process.env.NODE_ENV === 'dev') {
  78. exports.entry = [
  79. 'webpack/hot/dev-server',
  80. 'webpack-dev-server/client?http://localhost:8080',
  81. path.resolve(__dirname, 'app/index.js')
  82. ]
  83. }
  84. module.exports = exports