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.

webpack.config.js 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const HtmlWebpackPlugin = require('html-webpack-plugin');
  4. module.exports = {
  5. entry: './src/index.tsx',
  6. output: {
  7. filename: 'main.js',
  8. path: path.resolve(__dirname, 'dist'),
  9. clean: true,
  10. },
  11. resolve: {
  12. alias: {
  13. 'client': path.join(__dirname, '../pkg/')
  14. },
  15. fallback: {
  16. "buffer": require.resolve("buffer")
  17. }
  18. },
  19. mode: "development",
  20. devServer: {
  21. static: {
  22. directory: path.join(__dirname, 'dist'),
  23. },
  24. compress: true,
  25. port: 9000,
  26. client: {
  27. logging: 'none',
  28. progress: true,
  29. overlay: {
  30. errors: true,
  31. warnings: false,
  32. }
  33. },
  34. },
  35. resolve: {
  36. extensions: ['.tsx', '.ts', '.js'],
  37. },
  38. module: {
  39. rules: [
  40. {
  41. test: /\.tsx?$/,
  42. use: 'ts-loader',
  43. exclude: /node_modules/,
  44. },
  45. {
  46. test: /\.css?$/,
  47. use: 'css-loader',
  48. },
  49. ],
  50. },
  51. plugins: [
  52. new webpack.ProvidePlugin({
  53. Buffer: ['buffer', 'Buffer'],
  54. }),
  55. new HtmlWebpackPlugin({
  56. template: 'public/index.html',
  57. })
  58. ],
  59. experiments: {
  60. asyncWebAssembly: true,
  61. topLevelAwait: true
  62. }
  63. };