1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | const path = require("path");
|
7 | const webpack = require("webpack");
|
8 | const TerserPlugin = require("terser-webpack-plugin");
|
9 | const package = require("./package");
|
10 | const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
|
11 |
|
12 | const PATHS = {
|
13 | entryPoint: path.resolve(__dirname, "src/index.ts"),
|
14 | bundles: path.resolve(__dirname, "dist"),
|
15 | };
|
16 |
|
17 | module.exports = {
|
18 | mode: "production",
|
19 | entry: {
|
20 | "msal": [PATHS.entryPoint],
|
21 | "msal.min": [PATHS.entryPoint]
|
22 | },
|
23 | output: {
|
24 | path: PATHS.bundles,
|
25 | filename: "[name].js",
|
26 | libraryTarget: "umd",
|
27 | library: "Msal",
|
28 | umdNamedDefine: true
|
29 | },
|
30 | resolve: {
|
31 | extensions: [".ts", ".tsx", ".js"]
|
32 | },
|
33 |
|
34 | devtool: "source-map",
|
35 | plugins: [
|
36 | new ForkTsCheckerWebpackPlugin(),
|
37 | new webpack.BannerPlugin({
|
38 | banner: `/*! ${package.name} v${package.version} ${new Date().toISOString().split("T")[0]} */\n'use strict';`,
|
39 | raw: true
|
40 | })
|
41 | ],
|
42 | optimization: {
|
43 | minimize: true,
|
44 | minimizer: [new TerserPlugin({
|
45 | include: /\.min\.js$/,
|
46 | extractComments: false
|
47 | })]
|
48 | },
|
49 | module: {
|
50 | rules: [{
|
51 | test: /\.(ts|tsx|js)?$/,
|
52 | use: {
|
53 | loader: "ts-loader",
|
54 | options: {
|
55 | transpileOnly: true,
|
56 | }
|
57 | }
|
58 | }]
|
59 | }
|
60 | };
|