webpack.config.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const path = require('path');
  2. const VueLoaderPlugin = require('vue-loader/lib/plugin')
  3. const projectName = "inspection"
  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: 'inspection',
  13. },
  14. node: {
  15. fs: "empty"
  16. },
  17. module: {
  18. rules: [
  19. {
  20. test: /\.vue$/,
  21. loader: 'vue-loader',
  22. options: {
  23. loaders: {
  24. js: 'babel-loader'
  25. },
  26. },
  27. },
  28. {
  29. test: /\.js$/,
  30. loader: 'babel-loader',
  31. exclude: /node_modules/,
  32. include: path.join(__dirname, './src'),
  33. },
  34. {
  35. test: /\.(png|jpg|gif|svg)$/,
  36. loader: 'file-loader',
  37. options: {
  38. name: '[name].[ext]?[hash]',
  39. publicPath: `../${projectName}/`,
  40. }
  41. },
  42. {
  43. test: /\.(woff?|eot|ttf|otf)(\?.*)?$/,
  44. loader: 'url-loader',
  45. options: {
  46. limit: 10000,
  47. name: 'fonts/[name].[hash:7].[ext]',
  48. publicPath: `../${projectName}`,
  49. }
  50. },
  51. {
  52. test: /\.css$/,
  53. use: [
  54. 'vue-style-loader',
  55. 'css-loader'
  56. ]
  57. },
  58. {
  59. test: /\.scss$/,
  60. loaders: ["vue-style-loader", "css-loader", "sass-loader"]
  61. }
  62. ]
  63. },
  64. resolve: {
  65. alias: {
  66. 'vue$': 'vue/dist/vue.esm.js',
  67. '@': path.join(__dirname, './src'),
  68. },
  69. extensions: [
  70. ".js", ".vue"
  71. ],
  72. modules: [
  73. __dirname,
  74. 'node_modules',
  75. ],
  76. },
  77. mode: 'development',
  78. devtool: 'cheap-module-source-map',
  79. externals: [
  80. ],
  81. plugins: [
  82. new VueLoaderPlugin()
  83. ],
  84. };