UNPKG

1.59 kBJavaScriptView Raw
1/*
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License.
4 */
5
6const path = require("path");
7const webpack = require("webpack");
8const TerserPlugin = require("terser-webpack-plugin");
9const package = require("./package");
10const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
11
12const PATHS = {
13 entryPoint: path.resolve(__dirname, "src/index.ts"),
14 bundles: path.resolve(__dirname, "dist"),
15};
16
17module.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};