webpack.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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: '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. { test: /\.js.map$/, use: 'file-loader' },
  16. {
  17. // In .css files, svg is loaded as a data URI.
  18. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  19. issuer: { test: /\.css$/ },
  20. use: {
  21. loader: 'svg-url-loader',
  22. options: { encoding: 'none', limit: 10000 }
  23. }
  24. },
  25. {
  26. // In .ts and .tsx files (both of which compile to .js), svg files
  27. // must be loaded as a raw string instead of data URIs.
  28. test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
  29. issuer: { test: /\.js$/ },
  30. use: {
  31. loader: 'raw-loader'
  32. }
  33. },
  34. {
  35. test: /\.(png|jpg|gif|ttf|woff|woff2|eot)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  36. use: [{ loader: 'url-loader', options: { limit: 10000 } }]
  37. }
  38. ]
  39. }
  40. };