webpack.config.base.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. 'use strict'
  2. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  3. const { VueLoaderPlugin } = require('vue-loader')
  4. const utils = require('./utils')
  5. const themePath = 'web/themes/custom/materiotheme'
  6. module.exports = {
  7. resolve: {
  8. extensions: ['.js', '.vue', '.json'],
  9. alias: {
  10. 'vue': 'vue/dist/vue.js',
  11. 'theme': utils.resolve(themePath),
  12. 'vuejs': utils.resolve(themePath+'/vuejs')
  13. }
  14. },
  15. entry: {
  16. 'main': utils.resolve(themePath + '/assets/scripts/main.js'),
  17. },
  18. output: {
  19. path: utils.resolve(themePath + '/assets/dist/'),
  20. filename: '[name].js'
  21. },
  22. module: {
  23. rules: [
  24. {
  25. test: /\.(js|vue)$/,
  26. loader: 'eslint-loader',
  27. enforce: 'pre',
  28. exclude: /node_modules/,
  29. options: {
  30. emitError: true,
  31. emitWarning: true
  32. }
  33. },
  34. {
  35. test: /\.vue$/,
  36. use: 'vue-loader'
  37. },
  38. {
  39. test: /\.js$/,
  40. use: {
  41. loader: 'babel-loader',
  42. }
  43. }
  44. // , {
  45. // test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
  46. // use: {
  47. // loader: 'url-loader',
  48. // options: {
  49. // limit: 10000,
  50. // name: utils.assetsPath('img/[name].[hash:7].[ext]')
  51. // }
  52. // }
  53. // }, {
  54. // test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
  55. // use: {
  56. // loader: 'url-loader',
  57. // options: {
  58. // limit: 10000,
  59. // name: utils.assetsPath('media/[name].[hash:7].[ext]')
  60. // }
  61. // }
  62. // }, {
  63. // test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  64. // use: {
  65. // loader: 'url-loader',
  66. // options: {
  67. // limit: 10000,
  68. // name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
  69. // }
  70. // }
  71. // }
  72. ]
  73. },
  74. plugins: [
  75. new MiniCssExtractPlugin({
  76. path: utils.resolve(themePath + '/assets/dist/'),
  77. filename: '[name].css'
  78. }),
  79. new VueLoaderPlugin()
  80. ]
  81. }