const path = require('path');
let HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'eval-source-map',
entry: './src/index.ts',
// output: {
// filename: 'main.js',
// path: path.resolve(__dirname, 'public'),
// },
devServer: {
contentBase: "./public",//本地服务器所加载的页面所在的目录
historyApiFallback: true,//不跳转
inline: true//实时刷新
},
module: {
rules: [
{ test: /\.tsx?$/, loader: 'ts-loader', exclude: /(node_modules)/, }
]
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(path.resolve(__dirname), 'public/index.html'),
inject: 'body'
}),
],
resolve: {
// Add '.ts' and '.tsx' as a resolvable extension.
extensions: ['.ts', '.tsx', '.js']
},
};