const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const HtmlWebpackPlugin = require('html-webpack-plugin'); const path = require('path'); const webpack = require('webpack'); const VueLoaderPlugin = require('vue-loader').VueLoaderPlugin; const TerserPlugin = require('terser-webpack-plugin'); const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin'); const package = require('./package.json'); const devtoolModuleFilenameTemplate = info => { let $filename = 'sources://' + info.resourcePath; if (info.resourcePath.match(/\.vue$/) && !info.query.match(/type=script/)) { $filename = 'webpack-generated:///' + info.resourcePath + '?' + info.hash; } return $filename; }; const devtoolFallbackModuleFilenameTemplate = 'webpack:///[resource-path]?[hash]'; module.exports = (env, argv) => { const isProduction = argv.mode === 'production'; const devtool = isProduction ? undefined : '#eval-source-map'; const config = { entry: './src/index.ts', output: { path: path.resolve(__dirname, './dist'), filename: 'callus.js', library: 'callus', libraryTarget: 'umd', //https://www.mistergoodcat.com/post/the-joy-that-is-source-maps-with-vuejs-and-typescript devtoolModuleFilenameTemplate, devtoolFallbackModuleFilenameTemplate }, module: { rules: [ { test: /\.vue$/, loader: 'vue-loader', options: { shadowMode: true } }, { test: /\.(scss|css)$/, oneOf: [ // this matches `