webpack.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. const path = require('path')
  2. const VueLoaderPlugin = require('vue-loader/lib/plugin')
  3. const projectName = 'projectmanage'
  4. module.exports = {
  5. entry: {
  6. singleSpaEntry: ['src/singleSpaEntry.js']
  7. },
  8. output: {
  9. filename: '[name].js',
  10. path: path.resolve(__dirname, 'dist'),
  11. libraryTarget: 'umd',
  12. library: 'projectmanage'
  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. name: '[name].[ext]?[hash]',
  36. publicPath: `../${projectName}`
  37. }
  38. },
  39. {
  40. test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
  41. loader: 'url-loader',
  42. options: {
  43. limit: 10000,
  44. name: 'fonts/[name].[hash:7].[ext]',
  45. publicPath: `../${projectName}`
  46. }
  47. },
  48. {
  49. test: /\.css$/,
  50. use: ['vue-style-loader', 'css-loader']
  51. },
  52. {
  53. test: /\.scss$/,
  54. loaders: ['vue-style-loader', 'css-loader', 'sass-loader']
  55. }
  56. ]
  57. },
  58. resolve: {
  59. alias: {
  60. vue$: 'vue/dist/vue.esm.js',
  61. '@': path.join(__dirname, './src')
  62. },
  63. extensions: ['.js', '.vue'],
  64. modules: [__dirname, 'node_modules']
  65. },
  66. mode: 'development',
  67. devtool: 'cheap-module-source-map',
  68. externals: [],
  69. plugins: [new VueLoaderPlugin()]
  70. }