webpack.config.base.js 1.9 KB

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