webpack.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const webpack = require('webpack');
  2. module.exports = {
  3. entry: ['whatwg-fetch', './build/index.js'],
  4. output: {
  5. path: __dirname + '/build',
  6. filename: 'bundle.js'
  7. },
  8. bail: true,
  9. devtool: 'cheap-source-map',
  10. mode: 'development',
  11. module: {
  12. rules: [
  13. { test: /\.css$/, use: ['style-loader', 'css-loader'] },
  14. { test: /\.html$/, use: 'file-loader' },
  15. { test: /\.md$/, use: 'raw-loader' },
  16. { test: /\.js.map$/, use: 'file-loader' },
  17. {
  18. // In .css files, svg is loaded as a data URI.
  19. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  20. issuer: /\.css$/,
  21. use: {
  22. loader: 'svg-url-loader',
  23. options: { encoding: 'none', limit: 10000 }
  24. }
  25. },
  26. {
  27. // In .ts and .tsx files (both of which compile to .js), svg files
  28. // must be loaded as a raw string instead of data URIs.
  29. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  30. issuer: /\.js$/,
  31. use: {
  32. loader: 'raw-loader'
  33. }
  34. },
  35. {
  36. test: /\.(png|jpg|gif|ttf|woff|woff2|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  37. use: [{ loader: 'url-loader', options: { limit: 10000 } }]
  38. }
  39. ]
  40. },
  41. plugins: [
  42. new webpack.DefinePlugin({
  43. // Needed for Blueprint. See https://github.com/palantir/blueprint/issues/4393
  44. 'process.env': '{}',
  45. // Needed for various packages using cwd(), like the path polyfill
  46. process: { cwd: () => '/' }
  47. })
  48. ]
  49. };