webpack.config.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. var Path = require('path');
  2. var LiveReloadPlugin = require('webpack-livereload-plugin')
  3. module.exports = {
  4. entry: Path.resolve('src/index.js'),
  5. output: {
  6. path: Path.resolve('static/src'),
  7. filename: 'main.js'
  8. },
  9. resolve: {
  10. extensions: ['.js', '.vue', '.json'],
  11. alias: {
  12. 'vue$': 'vue/dist/vue.esm.js',
  13. '@': Path.resolve('src')
  14. }
  15. },
  16. plugins: [
  17. new LiveReloadPlugin()
  18. ],
  19. module: {
  20. rules: [
  21. {
  22. test: /\.vue$/,
  23. loader: 'vue-loader'
  24. },
  25. {
  26. test: /\.js$/,
  27. exclude: /node_modules/,
  28. loader: 'babel-loader',
  29. include: Path.resolve('src')
  30. },
  31. {
  32. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  33. loader: 'url-loader',
  34. options: {
  35. limit: 10000,
  36. name: Path.posix.join('static', 'img/[name].[hash:7].[ext]')
  37. }
  38. }
  39. ]
  40. }
  41. }