webpack.config.js 900 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. module.exports = {
  4. mode: 'development',
  5. entry: './app/static/js/index.js',
  6. output: {
  7. filename: 'main.js',
  8. path: path.resolve(__dirname, 'app/static/js'),
  9. publicPath: 'static/js'
  10. },
  11. plugins: [
  12. new webpack.ProvidePlugin({
  13. $: "jquery",
  14. jQuery: "jquery"
  15. })
  16. ],
  17. devServer: {
  18. proxy: {
  19. '/': 'http://localhost:5000'
  20. }
  21. },
  22. module: {
  23. rules: [
  24. {
  25. test: /\.js$/,
  26. exclude: /node_modules/,
  27. use: {
  28. loader: 'babel-loader',
  29. options: {
  30. presets: ['@babel/preset-env']
  31. }
  32. }
  33. }
  34. ]
  35. },
  36. module: {
  37. rules: [
  38. {
  39. test: /\.css$/,
  40. use: ['style-loader', 'css-loader']
  41. }
  42. ]
  43. }
  44. };