webpack.web.config.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. useBabel: true,
  19. babelCore: '@babel/core',
  20. useCache: true,
  21. forceIsolatedModules: true,
  22. configFileName: 'tsconfig.web.json'
  23. }
  24. }
  25. ]
  26. },
  27. resolve: {
  28. extensions: ['.ts', '.js']
  29. },
  30. plugins: [
  31. new webpack.BannerPlugin(
  32. {
  33. banner: WebpackUtils.getBannerText(WebpackUtils.getLicenseText()),
  34. raw: true,
  35. entryOnly: false
  36. }
  37. ),
  38. new webpack.EnvironmentPlugin({
  39. VERSION: packageJson.version
  40. })
  41. ],
  42. output: {
  43. libraryTarget: 'var',
  44. library: 'JavaScriptObfuscator',
  45. filename: 'index.web.js'
  46. },
  47. performance: {
  48. hints: false
  49. },
  50. stats: {
  51. maxModules: 0,
  52. warnings: false
  53. }
  54. };