webpack.config.js 1.1 KB

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