webpack.config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. 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: [path.resolve(__dirname, 'node_modules/@types')],
  32. paths: {
  33. "terminus-*": [path.resolve(__dirname, '../terminus-*')],
  34. "*": [path.resolve(__dirname, '../app/node_modules/*')],
  35. }
  36. }
  37. }
  38. },
  39. { test: /\.pug$/, use: ['apply-loader', 'pug-loader'] },
  40. { test: /\.scss$/, use: ['to-string-loader', 'css-loader', 'sass-loader'] },
  41. ]
  42. },
  43. externals: [
  44. 'fs',
  45. 'font-manager',
  46. 'path',
  47. 'mz/fs',
  48. 'mz/child_process',
  49. /^rxjs/,
  50. /^@angular/,
  51. /^@ng-bootstrap/,
  52. /^terminus-/,
  53. ],
  54. plugins: [
  55. new webpack.optimize.ModuleConcatenationPlugin(),
  56. ],
  57. }