Guest User

Untitled

a guest
May 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. const HtmlWebPackPlugin = require("html-webpack-plugin");
  2.  
  3. var path= require('path');
  4.  
  5. // this will create index.html file containing script
  6. // source in dist folder dynamically
  7. const htmlPlugin = new HtmlWebPackPlugin({
  8. template: "./src/index.html",
  9. filename: "./index.html"
  10. });
  11.  
  12. module.exports = {
  13. //specify the entry point for your project
  14. entry : './src/index.js',
  15. // specify the output file name
  16. output: {
  17. path: path.resolve(__dirname, 'dist'),
  18. filename: 'index.js'
  19. },
  20. module: {
  21. // consists the transform configuration
  22. rules: [
  23. {
  24. test: /\.js$/,
  25. exclude: /node_modules/,
  26. use: {
  27. loader: "babel-loader"
  28. }
  29. },
  30. {
  31. test: /\.css$/,
  32. use: ["style-loader", "css-loader"]
  33. }
  34. ]
  35. },
  36. // this will create a development server to host our application
  37. // and will also provide live reload functionality
  38. devServer: {
  39. contentBase: path.join(__dirname, "dist"),
  40. compress: true,
  41. port: 3001
  42. },
  43.  
  44. // this will watch the bundle for any changes
  45. watch: true,
  46. // specify the plugins which you are using
  47. plugins: [htmlPlugin]
  48. };
Add Comment
Please, Sign In to add comment