diff options
| author | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-05-24 01:00:37 +0200 |
|---|---|---|
| committer | Maks Jopek <maksymilian.jopek@prym-soft.pl> | 2021-05-24 01:00:37 +0200 |
| commit | b896880f0a1d08f1e46f69676bab95af6ec44b50 (patch) | |
| tree | 09a19e3f1c05845e6e88f17f5b824b8656ca1828 /webpack.config.ts | |
| download | IRC-b896880f0a1d08f1e46f69676bab95af6ec44b50.tar.gz IRC-b896880f0a1d08f1e46f69676bab95af6ec44b50.tar.zst IRC-b896880f0a1d08f1e46f69676bab95af6ec44b50.zip | |
Initial commit
Diffstat (limited to 'webpack.config.ts')
| -rw-r--r-- | webpack.config.ts | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/webpack.config.ts b/webpack.config.ts new file mode 100644 index 0000000..9ba1cd7 --- /dev/null +++ b/webpack.config.ts @@ -0,0 +1,51 @@ +import path from "path"; +import HtmlWebpackPlugin from "html-webpack-plugin"; +import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin"; +import dotenv from "dotenv"; + +dotenv.config(); + +const absolutePath = (relativePath: string) => + path.resolve(__dirname, relativePath); + +module.exports = { + mode: process.env.MODE, + entry: "src/index.ts", + module: { + rules: [ + { + test: /\.ts$/, + include: [absolutePath("src")], + use: "ts-loader", + }, + { + test: /\.js$/, + enforce: "pre", + use: "source-map-loader", + }, + ], + }, + resolve: { + extensions: [".ts", "..."], + plugins: [new TsconfigPathsPlugin()], + }, + devtool: + process.env.MODE === "development" + ? "eval-cheap-module-source-map" + : undefined, + output: { + filename: "bundle.js", + path: absolutePath("dist"), + }, + plugins: [ + new HtmlWebpackPlugin({ + template: "src/index.html", + staticPath: "static", + }), + ], + devServer: { + contentBase: absolutePath("dist"), + compress: true, + port: 8000, + }, +}; |
