webpack.config.js 998 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const path = require('path')
  2. const Copy = require('copy-webpack-plugin')
  3. const LiveReloadPlugin = require('webpack-livereload-plugin')
  4. module.exports = {
  5. devtool: 'source-map',
  6. mode: process.env.NODE_ENV || 'development',
  7. plugins: [
  8. new Copy([
  9. { from: 'app/index.html', to: 'index.html' }
  10. ]),
  11. new LiveReloadPlugin({
  12. appendScriptTag: true
  13. })
  14. ],
  15. entry: './app/index.js',
  16. output: {
  17. path: path.resolve(__dirname, 'public'),
  18. filename: 'index.js'
  19. },
  20. module:{
  21. rules:[
  22. // {
  23. // test:/\.js$/,
  24. // exclude: /node_modules/,
  25. // use: {
  26. // loader: 'babel-loader',
  27. // options: { presets: ['es2015'] }
  28. // }
  29. // },
  30. {
  31. test:/\.(s*)css$/,
  32. use:['style-loader','css-loader', 'sass-loader']
  33. },
  34. {
  35. test:/\.(?:svg|eot|woff2|woff|ttf)$/,
  36. use:['file-loader']
  37. },
  38. {
  39. test:/\.html$/,
  40. use:['html-loader']
  41. },
  42. ]
  43. }
  44. };