webpack.config.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. const path = require('path')
  2. const VueLoaderPlugin = require('vue-loader/lib/plugin')
  3. const projectName = 'ywbb'
  4. module.exports = {
  5. entry: {
  6. singleSpaEntry: ['src/singleSpaEntry.js']
  7. },
  8. output: {
  9. filename: '[name].js',
  10. path: path.resolve(__dirname, 'ywbb'),
  11. libraryTarget: 'umd',
  12. library: 'ywbb'
  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: 100000,
  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: 'none',
  68. externals: {
  69. './cptable': 'var cptable'
  70. },
  71. plugins: [new VueLoaderPlugin()],
  72. node: {
  73. fs: 'empty'
  74. },
  75. }