webpack.node.config.js 1.7 KB

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