ts-sdk

webpack.config.js 938B

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