webpack.config.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. const path = require('path');
  2. const VueLoaderPlugin = require('vue-loader/lib/plugin')
  3. const projectName = "decision"
  4. module.exports = {
  5. entry: {
  6. singleSpaEntry:['src/singleSpaEntry.js']
  7. },
  8. output: {
  9. filename: '[name].js',
  10. path: path.resolve(__dirname, 'decision'),
  11. libraryTarget: 'umd',
  12. library: 'decision',
  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: [
  51. 'vue-style-loader',
  52. 'css-loader'
  53. ]
  54. },
  55. {
  56. test: /\.scss$/,
  57. loaders: ["vue-style-loader", "css-loader", "sass-loader"]
  58. }
  59. ]
  60. },
  61. resolve: {
  62. alias: {
  63. 'vue$': 'vue/dist/vue.esm.js',
  64. '@': path.join(__dirname, './src'),
  65. },
  66. extensions: [
  67. ".js", ".vue"
  68. ],
  69. modules: [
  70. __dirname,
  71. 'node_modules',
  72. ],
  73. },
  74. mode: 'development',
  75. devtool: 'none',
  76. externals: [
  77. ],
  78. plugins: [
  79. new VueLoaderPlugin()
  80. ],
  81. };