webpack.common.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Password Management Servlets (PWM)
  3. * http://www.pwm-project.org
  4. *
  5. * Copyright (c) 2006-2009 Novell, Inc.
  6. * Copyright (c) 2009-2018 The PWM Project
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  21. */
  22. var HtmlWebpackPlugin = require('html-webpack-plugin');
  23. var autoPrefixer = require('autoprefixer');
  24. var path = require('path');
  25. var webpack = require('webpack');
  26. var outDir = path.resolve(__dirname, 'dist');
  27. module.exports = {
  28. devServer: {
  29. contentBase: outDir,
  30. // outputPath: outDir,
  31. port: 4000,
  32. historyApiFallback: true
  33. },
  34. // Externals copied to /dist via CopyWebpackPlugin
  35. externals:
  36. {
  37. 'angular': true,
  38. // Wrapped in window because of hyphens
  39. 'angular-ui-router': 'window["angular-ui-router"]',
  40. 'angular-translate': 'window["angular-translate"]'
  41. },
  42. module: {
  43. rules: [
  44. {
  45. test: /\.ts$/,
  46. enforce: 'pre',
  47. loader: 'tslint-loader'
  48. },
  49. {
  50. test: /\.ts$/,
  51. loader: 'ts-loader',
  52. exclude: /node_modules/
  53. },
  54. {
  55. test: /index\.html$/,
  56. loader: 'html-loader',
  57. exclude: /node_modules/
  58. },
  59. {
  60. test: /\.html$/,
  61. loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, './src')) + '/!html-loader',
  62. exclude: /index\.html$/
  63. },
  64. {
  65. test: /\.scss$/,
  66. loaders: [ 'style-loader', 'css-loader', 'sass-loader', {
  67. loader: 'postcss-loader',
  68. options: {
  69. plugins: function () {
  70. return [autoPrefixer('last 2 versions')]
  71. }
  72. }
  73. }]
  74. },
  75. {
  76. test: /\.(png|jpg|jpeg|gif|svg)$/,
  77. loaders: [ 'url-loader?limit=25000' ]
  78. }
  79. ]
  80. },
  81. // [name] is replaced by entry point name
  82. output: {
  83. filename: '[name].js',
  84. path: outDir
  85. },
  86. plugins: [
  87. new HtmlWebpackPlugin({
  88. chunks: ['peoplesearch.ng'],
  89. filename: 'peoplesearch.html',
  90. template: 'index.html',
  91. // title: 'PeopleSearch Development',
  92. inject: 'body'
  93. }),
  94. new HtmlWebpackPlugin({
  95. chunks: ['helpdesk.ng'],
  96. filename: 'helpdesk.html',
  97. template: 'index.html',
  98. // title: 'PeopleSearch Development',
  99. inject: 'body'
  100. })
  101. ],
  102. resolve: {
  103. extensions: [ '.ts', '.js', '.json' ],
  104. modules: ['./src', './vendor', 'node_modules']
  105. }
  106. };