webpack.config.js 1.5 KB

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