webpack.config.js 1.4 KB

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