ts-sdk

webpack.config.dev.js 942B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* eslint-disable @typescript-eslint/no-var-requires */
  2. const path = require('path');
  3. const rootPath = process.cwd();
  4. const HtmlWebpackPlugin = require('html-webpack-plugin');
  5. module.exports = {
  6. mode: 'development',
  7. entry: './example/main.ts',
  8. devtool: 'inline-source-map',
  9. devServer: {
  10. compress: true,
  11. hot: true,
  12. },
  13. plugins: [
  14. new HtmlWebpackPlugin({
  15. title: 'index',
  16. }),
  17. ],
  18. output: {
  19. filename: '[name].bundle.js',
  20. path: path.resolve(rootPath, 'dist'),
  21. },
  22. resolve: { extensions: ['.js', '.jsx', '.tsx', '.ts', '.json'] },
  23. module: {
  24. rules: [
  25. {
  26. // Include ts, tsx, js, and jsx files.
  27. test: /\.(ts|js)x?$/,
  28. exclude: /node_modules/,
  29. loader: 'babel-loader',
  30. },
  31. {
  32. test: /\.(ts|js)x?$/,
  33. loader: 'eslint-loader',
  34. options: {
  35. formatter: require('eslint-friendly-formatter'),
  36. },
  37. },
  38. ],
  39. },
  40. };