summaryrefslogtreecommitdiffhomepage
path: root/packages/browser/webpack.config.js
blob: 1c060c38acd32547886432c062ea9f8a52fe3d29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const path = require('path');
const WebpackAutoInject = require('webpack-auto-inject-version');

const packageJSON = require('./package.json');
const outputPath = path.resolve(__dirname, 'dist');

module.exports = {
  entry: './src/index.ts',
  mode: 'production',
  devtool: 'source-map',
  module: {
    rules: [
      {
        test: /.ts$/,
        use: 'ts-loader',
        exclude: /node_modules/,
      },
    ],
  },
  resolve: {
    extensions: ['.ts', '.js'],
  },
  output: {
    path: outputPath,
    filename: 'simplewebauthn-browser.min.js',
    library: 'SimpleWebAuthnBrowser',
    libraryTarget: 'umd',
    globalObject: 'this',
  },
  plugins: [
    new WebpackAutoInject({
      SHORT: packageJSON.name,
      PACKAGE_JSON_INDENT: 2,
      components: {
        AutoIncreaseVersion: false,
      },
      componentsOptions: {
        InjectAsComment: {
          tag: 'Version: {version} - {date}',
          multiLineCommentType: true,
        },
      },
    }),
  ],
};