webpack.common.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. const path = require('path');
  2. const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
  3. module.exports = {
  4. target: 'web',
  5. entry: {
  6. app: './public/app/index.ts',
  7. },
  8. output: {
  9. path: path.resolve(__dirname, '../../public/build'),
  10. filename: '[name].[hash].js',
  11. // Keep publicPath relative for host.com/grafana/ deployments
  12. publicPath: "public/build/",
  13. },
  14. resolve: {
  15. extensions: ['.ts', '.tsx', '.es6', '.js', '.json', '.svg'],
  16. alias: {
  17. },
  18. modules: [
  19. path.resolve('public'),
  20. path.resolve('node_modules')
  21. ],
  22. },
  23. stats: {
  24. children: false,
  25. warningsFilter: /export .* was not found in/
  26. },
  27. node: {
  28. fs: 'empty',
  29. },
  30. module: {
  31. rules: [
  32. {
  33. test: require.resolve('jquery'),
  34. use: [
  35. {
  36. loader: 'expose-loader',
  37. query: 'jQuery'
  38. },
  39. {
  40. loader: 'expose-loader',
  41. query: '$'
  42. }
  43. ]
  44. },
  45. {
  46. test: /\.html$/,
  47. exclude: /(index|error)\-template\.html/,
  48. use: [
  49. { loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, '../../public')) + '&prefix=public' },
  50. {
  51. loader: 'html-loader',
  52. options: {
  53. attrs: [],
  54. minimize: true,
  55. removeComments: false,
  56. collapseWhitespace: false
  57. }
  58. }
  59. ]
  60. }
  61. ]
  62. },
  63. plugins: [
  64. new ForkTsCheckerWebpackPlugin({
  65. checkSyntacticErrors: true,
  66. }),
  67. ]
  68. };