webpack.common.js 1.5 KB

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