You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.2 KiB
52 lines
1.2 KiB
|
3 years ago
|
const path = require("path");
|
||
|
|
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||
|
|
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||
|
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||
|
|
const Dotenv = require("dotenv-webpack");
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
target: "web",
|
||
|
|
module: {
|
||
|
|
rules: [
|
||
|
|
{
|
||
|
|
exclude: [/node_modules/],
|
||
|
|
test: /\.ts$/,
|
||
|
|
loader: "ts-loader",
|
||
|
|
options: { configFile: "tsconfig.web.json" },
|
||
|
|
},
|
||
|
|
{
|
||
|
|
test: /\.(css|scss)$/,
|
||
|
|
use: ["css-loader", "sass-loader"],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
test: /\.(png|jpg|gif)$/,
|
||
|
|
type: "asset/resource",
|
||
|
|
},
|
||
|
|
],
|
||
|
|
},
|
||
|
|
output: {
|
||
|
|
filename: "bundle.[name].js",
|
||
|
|
path: path.resolve(__dirname, "dist", "web"),
|
||
|
|
},
|
||
|
|
resolve: {
|
||
|
|
extensions: [".ts", ".js"],
|
||
|
|
},
|
||
|
|
plugins: [
|
||
|
|
new CleanWebpackPlugin(),
|
||
|
|
new HtmlWebpackPlugin({
|
||
|
|
template: "./src/index.ejs",
|
||
|
|
title: "My App",
|
||
|
|
}),
|
||
|
|
new CopyWebpackPlugin({
|
||
|
|
patterns: [
|
||
|
|
"./node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js",
|
||
|
|
{
|
||
|
|
from: "./node_modules/@webcomponents/webcomponentsjs/bundles",
|
||
|
|
to: "bundles",
|
||
|
|
},
|
||
|
|
],
|
||
|
|
}),
|
||
|
|
new Dotenv(),
|
||
|
|
],
|
||
|
|
};
|