webpack.config.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. const path = require('path')
  2. const webpack = require('webpack')
  3. module.exports = {
  4. target: 'node',
  5. entry: 'src/index.ts',
  6. devtool: 'source-map',
  7. context: __dirname,
  8. output: {
  9. path: path.resolve(__dirname, 'dist'),
  10. filename: 'index.js',
  11. pathinfo: true,
  12. libraryTarget: 'umd',
  13. devtoolModuleFilenameTemplate: 'webpack-terminus-plugin-manager:///[resource-path]',
  14. },
  15. mode: process.env.TERMINUS_DEV ? 'development' : 'production',
  16. optimization:{
  17. minimize: false,
  18. },
  19. resolve: {
  20. modules: ['.', 'src', 'node_modules', '../app/node_modules'].map(x => path.join(__dirname, x)),
  21. extensions: ['.ts', '.js'],
  22. },
  23. module: {
  24. rules: [
  25. {
  26. test: /\.ts$/,
  27. use: {
  28. loader: 'awesome-typescript-loader',
  29. query: {
  30. configFileName: path.resolve(__dirname, 'tsconfig.json'),
  31. typeRoots: [
  32. path.resolve(__dirname, 'node_modules/@types'),
  33. path.resolve(__dirname, '../node_modules/@types')
  34. ],
  35. paths: {
  36. "terminus-*": [path.resolve(__dirname, '../terminus-*')],
  37. "*": [path.resolve(__dirname, '../app/node_modules/*')],
  38. }
  39. }
  40. }
  41. },
  42. { test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
  43. { test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
  44. ]
  45. },
  46. externals: [
  47. 'fs',
  48. 'net',
  49. 'npm',
  50. 'path',
  51. /^rxjs/,
  52. /^@angular/,
  53. /^@ng-bootstrap/,
  54. /^terminus-/,
  55. ],
  56. plugins: [
  57. new webpack.optimize.ModuleConcatenationPlugin(),
  58. ],
  59. }