webpack.config.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. var path = require('path');
  2. var HtmlWebpackPlugin = require('html-webpack-plugin');
  3. var UpdateVersionPlugin = require('./updateVersionPlugin');
  4. module.exports = {
  5. entry: path.resolve(__dirname, 'js/main.js'),
  6. output: {
  7. path: path.resolve(__dirname, 'build'),
  8. filename: '[name].[contenthash].js',
  9. library: 'ivprogCore',
  10. libraryTarget: 'umd'
  11. },
  12. node: {
  13. fs: 'empty',
  14. },
  15. module: {
  16. rules: [
  17. {
  18. test: /\.js$/,
  19. exclude: /(node_modules)/,
  20. use: {
  21. loader: "babel-loader",
  22. options: {
  23. presets: ["@babel/preset-env"]
  24. }
  25. }
  26. },
  27. {
  28. test: /\.g4$/,
  29. exclude: /(node_modules)/,
  30. use: {
  31. loader:'antlr4-webpack-loader'
  32. }
  33. }
  34. ]
  35. },
  36. stats: {
  37. colors: true
  38. },
  39. plugins: [
  40. new UpdateVersionPlugin(),
  41. new HtmlWebpackPlugin({
  42. template: 'templates/index.html',
  43. filename: '../index.html'
  44. }),
  45. new HtmlWebpackPlugin({
  46. template: 'templates/runner.html',
  47. filename: '../runner.html'
  48. })
  49. ],
  50. optimization: {
  51. splitChunks: {
  52. chunks: 'all'
  53. }
  54. },
  55. devtool: 'source-map',
  56. watchOptions: {
  57. ignored: path.resolve(__dirname, '.ima_version.json')
  58. }
  59. };