webpack.config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. module.exports = {
  2. entry: ['whatwg-fetch', './build/index.js'],
  3. output: {
  4. path: __dirname + '/build',
  5. filename: 'bundle.js'
  6. },
  7. bail: true,
  8. devtool: 'cheap-source-map',
  9. mode: 'production',
  10. module: {
  11. rules: [
  12. { test: /\.css$/, use: ['style-loader', 'css-loader'] },
  13. { test: /\.html$/, use: 'file-loader' },
  14. { test: /\.md$/, use: 'raw-loader' },
  15. {
  16. // In .css files, svg is loaded as a data URI.
  17. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  18. issuer: { test: /\.css$/ },
  19. use: {
  20. loader: 'svg-url-loader',
  21. options: { encoding: 'none', limit: 10000 }
  22. }
  23. },
  24. {
  25. // In .ts and .tsx files (both of which compile to .js), svg files
  26. // must be loaded as a raw string instead of data URIs.
  27. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  28. issuer: { test: /\.js$/ },
  29. use: {
  30. loader: 'raw-loader'
  31. }
  32. },
  33. {
  34. test: /\.(png|jpg|gif|ttf|woff|woff2|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  35. use: [{ loader: 'url-loader', options: { limit: 10000 } }]
  36. }
  37. ]
  38. }
  39. };