webpack.browser.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. 'use strict';
  2. const webpack = require('webpack');
  3. const packageJson = require('pjson');
  4. const WebpackUtils = require('./utils/WebpackUtils').WebpackUtils;
  5. module.exports = {
  6. devtool: 'source-map',
  7. entry: {
  8. 'index': './index.ts'
  9. },
  10. target: 'web',
  11. module: {
  12. exprContextCritical: false,
  13. rules: [
  14. {
  15. test: /\.ts(x?)$/,
  16. loader: 'awesome-typescript-loader',
  17. query: {
  18. configFileName: 'src/tsconfig.browser.json',
  19. useCache: true,
  20. forceIsolatedModules: true
  21. }
  22. }
  23. ]
  24. },
  25. resolve: {
  26. extensions: ['.ts', '.js']
  27. },
  28. plugins: [
  29. new webpack.BannerPlugin(
  30. {
  31. banner: WebpackUtils.getBannerText(WebpackUtils.getLicenseText()),
  32. raw: true,
  33. entryOnly: false
  34. }
  35. ),
  36. new webpack.EnvironmentPlugin({
  37. VERSION: packageJson.version
  38. })
  39. ],
  40. output: {
  41. libraryTarget: 'umd',
  42. library: 'JavaScriptObfuscator',
  43. filename: 'index.browser.js'
  44. },
  45. performance: {
  46. hints: false
  47. },
  48. stats: {
  49. maxModules: 0,
  50. warnings: false
  51. }
  52. };