webpack.config.base.js 2.2 KB

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