webpack.common.js 1008 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. const path = require('path')
  2. module.exports = {
  3. entry: './src/main.js',
  4. output: {
  5. path: path.resolve(__dirname, './js'),
  6. publicPath: '/dist/',
  7. filename: 'main.js'
  8. },
  9. module: {
  10. rules: [
  11. {
  12. test: /\.css$/,
  13. use: [
  14. 'vue-style-loader',
  15. 'css-loader'
  16. ],
  17. },
  18. {
  19. test: /\.scss$/,
  20. use: [
  21. 'vue-style-loader',
  22. 'css-loader',
  23. ],
  24. },
  25. {
  26. test: /\.vue$/,
  27. loader: 'vue-loader',
  28. options: {
  29. loaders: {}
  30. // other vue-loader options go here
  31. }
  32. },
  33. {
  34. test: /\.js$/,
  35. loader: 'babel-loader',
  36. exclude: /node_modules/
  37. },
  38. {
  39. test: /\.(png|jpg|gif|svg)$/,
  40. loader: 'file-loader',
  41. options: {
  42. name: '[name].[ext]?[hash]'
  43. }
  44. }
  45. ]
  46. },
  47. resolve: {
  48. alias: {
  49. 'vue$': 'vue/dist/vue.esm.js'
  50. },
  51. extensions: ['*', '.js', '.vue', '.json']
  52. }
  53. }