webpack.config.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. const path = require('path');
  2. const VueLoaderPlugin = require('vue-loader/lib/plugin')
  3. const CopyWebpackPlugin = require('copy-webpack-plugin')
  4. module.exports = {
  5. entry: {
  6. singleSpaEntry:['src/singleSpaEntry.js']
  7. },
  8. output: {
  9. filename: '[name].js',
  10. path: path.resolve(__dirname, 'quality'),
  11. libraryTarget: 'umd',
  12. library: 'quality',
  13. },
  14. module: {
  15. rules: [
  16. {
  17. test: /\.vue$/,
  18. loader: 'vue-loader',
  19. options: {
  20. loaders: {
  21. js: 'babel-loader'
  22. },
  23. },
  24. },
  25. {
  26. test: /\.js$/,
  27. loader: 'babel-loader',
  28. exclude: /node_modules/,
  29. include: path.join(__dirname, './src'),
  30. },
  31. {
  32. test: /\.(png|jpg|gif|svg)$/,
  33. loader: 'file-loader',
  34. options: {
  35. limit: 100000,
  36. name: '[name].[ext]?[hash]',
  37. publicPath: './quality/',
  38. }
  39. },
  40. {
  41. test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  42. loader: 'url-loader',
  43. options: {
  44. limit: 100000,
  45. name: 'fonts/[name].[hash:7].[ext]',
  46. publicPath: './quality/',
  47. }
  48. },
  49. {
  50. test: /\.css$/,
  51. use: [
  52. 'vue-style-loader',
  53. 'css-loader'
  54. ]
  55. },
  56. {
  57. test: /\.scss$/,
  58. loaders: ["vue-style-loader", "css-loader", "sass-loader"]
  59. }
  60. ]
  61. },
  62. resolve: {
  63. alias: {
  64. 'vue$': 'vue/dist/vue.esm.js',
  65. '@': path.join(__dirname, './src'),
  66. },
  67. extensions: [
  68. ".js", ".vue"
  69. ],
  70. modules: [
  71. __dirname,
  72. 'node_modules',
  73. ],
  74. },
  75. mode: 'development',
  76. devtool: 'none',
  77. externals: [],
  78. plugins: [
  79. new CopyWebpackPlugin([
  80. {
  81. from: path.resolve(__dirname, './static'),
  82. to: __dirname+'/quality',
  83. ignore: ['.*']
  84. }
  85. ]),
  86. new VueLoaderPlugin()
  87. ]
  88. };