microsoft/TypeAgent
Publicmirrored from https://github.com/microsoft/TypeAgentAvailable
ts/examples/viewMarkdown/webpack.config.js
49lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | import path from "node:path"; |
| 5 | import { fileURLToPath } from "node:url"; |
| 6 | import CopyPlugin from "copy-webpack-plugin"; |
| 7 | import { setupMiddlewares } from "./dist/route/route.js"; |
| 8 | |
| 9 | const dirName = fileURLToPath(new URL(".", import.meta.url)); |
| 10 | const srcDir = path.join(dirName, "src"); |
| 11 | export default { |
| 12 | mode: "development", |
| 13 | devtool: "inline-source-map", |
| 14 | devServer: { |
| 15 | setupMiddlewares, |
| 16 | static: { |
| 17 | directory: path.join(dirName, "dist"), |
| 18 | }, |
| 19 | compress: true, |
| 20 | port: 9001, |
| 21 | }, |
| 22 | entry: { |
| 23 | index: path.join(srcDir, "site", "index.ts"), |
| 24 | }, |
| 25 | output: { |
| 26 | path: path.join(dirName, "dist"), |
| 27 | filename: "[name].js", |
| 28 | }, |
| 29 | module: { |
| 30 | rules: [ |
| 31 | { |
| 32 | test: /\.tsx?$/, |
| 33 | use: "ts-loader", |
| 34 | exclude: /node_modules/, |
| 35 | }, |
| 36 | ], |
| 37 | }, |
| 38 | resolve: { |
| 39 | extensions: [".tsx", ".ts", ".js"], |
| 40 | }, |
| 41 | plugins: [ |
| 42 | new CopyPlugin({ |
| 43 | patterns: [ |
| 44 | { from: path.join(srcDir, "site", "index.html"), to: "." }, |
| 45 | { from: path.join(srcDir, "site", "styles.css"), to: "." }, |
| 46 | ], |
| 47 | }), |
| 48 | ], |
| 49 | }; |
| 50 | |