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

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