webpack.config.js 799 B

1234567891011121314151617181920212223242526272829303132333435
  1. const pkg = require('./package.json')
  2. const path = require('path')
  3. const webpack = require('webpack')
  4. const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
  5. module.exports = {
  6. entry: './src/LSPlugin.user.ts',
  7. module: {
  8. rules: [
  9. {
  10. test: /\.tsx?$/,
  11. use: 'ts-loader',
  12. exclude: /node_modules/,
  13. },
  14. ],
  15. },
  16. resolve: {
  17. extensions: ['.tsx', '.ts', '.js'],
  18. },
  19. plugins: [
  20. new webpack.ProvidePlugin({
  21. process: 'process/browser',
  22. }),
  23. new webpack.DefinePlugin({
  24. LIB_VERSION: JSON.stringify(pkg.version)
  25. })
  26. // new BundleAnalyzerPlugin()
  27. ],
  28. output: {
  29. library: 'LSPluginEntry',
  30. libraryTarget: 'umd',
  31. filename: 'lsplugin.user.js',
  32. path: path.resolve(__dirname, 'dist')
  33. },
  34. }