webpack.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const path = require("path");
  2. const CopyPlugin = require('copy-webpack-plugin');
  3. module.exports = {
  4. entry: "./src/app/app.js",
  5. output: {
  6. filename: "main.js",
  7. path: path.resolve(__dirname, 'dist/js')
  8. },
  9. module: {
  10. rules: [
  11. {
  12. test: /\.css$/,
  13. use: ["style-loader", "css-loader"]
  14. }
  15. ]
  16. },
  17. module: {
  18. rules: [
  19. {
  20. test: /\.js$/,
  21. exclude: /node_modules/,
  22. use: {
  23. loader: "babel-loader"
  24. }
  25. }
  26. ]
  27. },
  28. plugins: [
  29. new CopyPlugin([
  30. {from:'src/index.html', to:path.resolve(__dirname, 'dist')},
  31. {from:'node_modules/jquery/dist/jquery.min.js', to:path.resolve(__dirname, 'dist/js')},
  32. {from:'node_modules/bootstrap/dist/js/bootstrap.min.js', to:path.resolve(__dirname, 'dist/js')},
  33. {from:'node_modules/konva/konva.min.js', to:path.resolve(__dirname, 'dist/js')},
  34. {from:'node_modules/bootstrap/dist/css/bootstrap.min.css', to:path.resolve(__dirname, 'dist/css')},
  35. {from:'src/css/', to:path.resolve(__dirname, 'dist/css')},
  36. {from:'src/assets/', to:path.resolve(__dirname, 'dist/assets')}
  37. ])
  38. ]
  39. };