2024-09-01 23:42:25 +02:00
|
|
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
2024-08-31 16:44:23 +02:00
|
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
const path = require('path');
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: './src/index.ts', // Entry file
|
2024-09-01 23:42:25 +02:00
|
|
|
devtool: "inline-source-map",
|
2024-08-31 16:44:23 +02:00
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, 'dist'),
|
2024-09-01 23:42:25 +02:00
|
|
|
clean: true,
|
2024-08-31 16:44:23 +02:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
2024-09-01 23:42:25 +02:00
|
|
|
test: /\.tsx?$/,
|
|
|
|
use: ['ts-loader'],
|
2024-08-31 16:44:23 +02:00
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.ink$/,
|
|
|
|
type: 'asset/source',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.s[ac]ss$/,
|
|
|
|
use: [
|
|
|
|
"style-loader", // Creates `style` nodes from JS strings
|
|
|
|
"css-loader", // Translates CSS into CommonJS
|
|
|
|
"sass-loader", // Compiles Sass to CSS
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['.ts', '.js'],
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
title: "Work It Out",
|
|
|
|
template: "src/index.html",
|
2024-09-01 23:42:25 +02:00
|
|
|
}),
|
|
|
|
new CopyWebpackPlugin({
|
|
|
|
patterns: [
|
|
|
|
{ from: "src/images", to: "images" },
|
|
|
|
]
|
|
|
|
}),
|
2024-08-31 16:44:23 +02:00
|
|
|
],
|
|
|
|
devServer: {
|
2024-09-01 23:42:25 +02:00
|
|
|
devMiddleware: {
|
|
|
|
index: true,
|
|
|
|
writeToDisk: true,
|
2024-08-31 16:44:23 +02:00
|
|
|
},
|
|
|
|
liveReload: true,
|
|
|
|
compress: true,
|
|
|
|
port: 9000,
|
|
|
|
},
|
2024-09-01 23:42:25 +02:00
|
|
|
optimization: {
|
|
|
|
runtimeChunk: 'single',
|
|
|
|
},
|
2024-08-31 16:44:23 +02:00
|
|
|
};
|