40 lines
933 B
JavaScript
40 lines
933 B
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
module.exports = {
|
|
entry: './src/index.js',
|
|
output: {
|
|
path: path.resolve(__dirname, './dist'),
|
|
filename: 'bundle.js',
|
|
publicPath: '/',
|
|
clean: true,
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
}
|
|
},
|
|
{
|
|
test: /\.css$/,
|
|
use: ['style-loader', 'css-loader'],
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: "./public/index.html",
|
|
inject: true
|
|
}),
|
|
],
|
|
devServer: {
|
|
static: path.join(__dirname, 'public'),
|
|
port: 3000,
|
|
open: true,
|
|
hot: true,
|
|
historyApiFallback: true,
|
|
}
|
|
}; |