webpack.config.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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: /\.css$/,
  33. loader: ['style-loader', 'css-loader']
  34. },
  35. {
  36. test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  37. loader: 'url-loader',
  38. options: {
  39. limit: 10000,
  40. name: Path.posix.join('static', 'img/[name].[hash:7].[ext]')
  41. }
  42. }
  43. ]
  44. }
  45. }