webpack.config.base.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. fix: true
  82. // exclude: ['node_modules', 'vendor', 'web/core']
  83. // cache: false,
  84. // ignore: true,
  85. // useEslintrc: false,
  86. })
  87. ]
  88. }