project/webpack.config.js

50 lines
1.3 KiB
JavaScript

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require("copy-webpack-plugin");
module.exports = {
entry: './src/index.ts',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
clean: true
},
resolve: {
extensions: ['.js', '.ts']
},
module: {
rules: [
{ test: /\.(ts|tsx)$/, loader: "ts-loader" },
{
test: /\.hbs|html$/,
loader: 'handlebars-loader',
},
{
test: /\.css$/i,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
template: "./src/index.hbs",
filename: "index.html"
}),
new HtmlWebpackPlugin({
template: "./src/creators.hbs",
filename: "creators.html"
}),
new HtmlWebpackPlugin({
template: "./src/discover.hbs",
filename: "discover.html"
}),
new CopyPlugin({
patterns: [
{from: "./src/images", to: "images"},
],
})
]
};