webpack.config.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. 'use strict';
  2. const nodeExternals = require('webpack-node-externals');
  3. const webpack = require('webpack');
  4. const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;
  5. const TSLintPlugin = require('tslint-webpack-plugin');
  6. const packageJson = require('pjson');
  7. const WebpackUtils = require('./utils/WebpackUtils').WebpackUtils;
  8. module.exports = {
  9. devtool: 'source-map',
  10. entry: {
  11. 'index': './index.ts',
  12. 'index.cli': './index.cli.ts'
  13. },
  14. target: 'node',
  15. externals: [nodeExternals()],
  16. module: {
  17. exprContextCritical: false,
  18. rules: [
  19. {
  20. test: /\.ts(x?)$/,
  21. loader: 'awesome-typescript-loader',
  22. query: {
  23. useBabel: true,
  24. babelCore: '@babel/core',
  25. useCache: true,
  26. forceIsolatedModules: true
  27. }
  28. }
  29. ]
  30. },
  31. resolve: {
  32. extensions: ['.ts']
  33. },
  34. plugins: [
  35. new webpack.BannerPlugin(
  36. {
  37. banner: WebpackUtils.getBannerText(
  38. WebpackUtils.getLicenseText(),
  39. WebpackUtils.getSourceMapSupportImport()
  40. ),
  41. raw: true,
  42. entryOnly: false
  43. }
  44. ),
  45. new webpack.EnvironmentPlugin({
  46. VERSION: packageJson.version
  47. }),
  48. new CheckerPlugin(),
  49. new TSLintPlugin({
  50. files: ['./src/**/*.ts'],
  51. project: './tsconfig.json',
  52. exclude: []
  53. })
  54. ],
  55. output: {
  56. libraryTarget: 'commonjs2',
  57. library: 'JavaScriptObfuscator'
  58. },
  59. stats: {
  60. maxModules: 0
  61. }
  62. };