Sin descripción
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 809B

12345678910111213141516171819202122232425262728293031
  1. const path = require('path');
  2. let HtmlWebpackPlugin = require('html-webpack-plugin');
  3. module.exports = {
  4. devtool: 'eval-source-map',
  5. entry: './src/index.ts',
  6. // output: {
  7. // filename: 'main.js',
  8. // path: path.resolve(__dirname, 'public'),
  9. // },
  10. devServer: {
  11. contentBase: "./public",//本地服务器所加载的页面所在的目录
  12. historyApiFallback: true,//不跳转
  13. inline: true//实时刷新
  14. },
  15. module: {
  16. rules: [
  17. { test: /\.tsx?$/, loader: 'ts-loader', exclude: /(node_modules)/, }
  18. ]
  19. },
  20. plugins: [
  21. new HtmlWebpackPlugin({
  22. template: path.resolve(path.resolve(__dirname), 'public/index.html'),
  23. inject: 'body'
  24. }),
  25. ],
  26. resolve: {
  27. // Add '.ts' and '.tsx' as a resolvable extension.
  28. extensions: ['.ts', '.tsx', '.js']
  29. },
  30. };