webpack.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. resolve: {
  16. modules: ['.', 'src', 'node_modules', '../app/node_modules'].map(x => path.join(__dirname, x)),
  17. extensions: ['.ts', '.js'],
  18. },
  19. module: {
  20. rules: [
  21. {
  22. test: /\.ts$/,
  23. use: {
  24. loader: 'awesome-typescript-loader',
  25. query: {
  26. configFileName: path.resolve(__dirname, 'tsconfig.json'),
  27. typeRoots: [path.resolve(__dirname, 'node_modules/@types')],
  28. paths: {
  29. "terminus-*": [path.resolve(__dirname, '../terminus-*')],
  30. "*": [path.resolve(__dirname, '../app/node_modules/*')],
  31. }
  32. }
  33. }
  34. },
  35. { test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
  36. { test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
  37. ]
  38. },
  39. externals: [
  40. 'fs',
  41. 'font-manager',
  42. 'path',
  43. 'mz/fs',
  44. 'mz/child_process',
  45. 'winreg',
  46. /^rxjs/,
  47. /^@angular/,
  48. /^@ng-bootstrap/,
  49. /^terminus-/,
  50. ],
  51. plugins: [
  52. new webpack.optimize.ModuleConcatenationPlugin(),
  53. ],
  54. }