UNPKG

@juststarting00/minimal-ts-app

Version:

A minimal TypeScript library that uses NPM. See README for further info

28 lines (25 loc) 855 B
const path = require('path'); module.exports = { mode: 'development', devtool: 'inline-source-map', entry: './src/NumberLibrary.ts', module: { rules: [ { test: /\.tsx?$/, use: 'ts-loader', exclude: /node_modules/, }, ], }, resolve: { extensions: ['.tsx', '.ts', '.js'], }, output: { filename: 'NumberLibrary.umd.js', path: path.resolve(__dirname, 'dist'), libraryTarget: "umd", // We want the bundle be a UMD globalObject: "this" // Without this, it's not consumable in NPM; found answer here: https://stackoverflow.com/questions/64639839/typescript-webpack-library-generates-referenceerror-self-is-not-defined //library: "myLib" // Specify the object name that will contain the exports - without this, exported items become global variables in HTML }, };