52 lines
1.0 KiB
JavaScript
52 lines
1.0 KiB
JavaScript
const path = require('path');
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
const CopyPlugin = require('copy-webpack-plugin');
|
|
|
|
module.exports = {
|
|
mode: 'development',
|
|
entry: './src/index.js',
|
|
output: {
|
|
filename: 'bundle.js',
|
|
path: path.resolve(__dirname, 'dist'),
|
|
clean: true,
|
|
},
|
|
devServer: {
|
|
static: './dist',
|
|
hot: true,
|
|
open: true,
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.m?js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
presets: [
|
|
['@babel/preset-env', {
|
|
targets: {
|
|
esmodules: true
|
|
}
|
|
}]
|
|
]
|
|
}
|
|
}
|
|
}
|
|
],
|
|
},
|
|
plugins: [
|
|
new HtmlWebpackPlugin({
|
|
template: './src/index.html',
|
|
title: 'Timer App',
|
|
}),
|
|
new CopyPlugin({
|
|
patterns: [
|
|
{ from: 'src/styles.css', to: 'styles.css' }
|
|
],
|
|
}),
|
|
],
|
|
resolve: {
|
|
extensions: ['.js', '.mjs']
|
|
}
|
|
}; |