webpack.doc.base.conf.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. const path = require('path');
  2. const webpackBaseConf = require('./webpack.base.conf.js');
  3. const HtmlWebpackPlugin = require('html-webpack-plugin');
  4. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  5. const merge = require('webpack-merge');
  6. const mdtohtml = require('../scripts/mdToVue');
  7. const isDev = process.env.NODE_ENV === 'development';
  8. module.exports = merge(webpackBaseConf, {
  9. entry: {
  10. app: './sites/doc/app.js',
  11. },
  12. output: {
  13. publicPath: '/',
  14. path: path.resolve(__dirname, '../dist/sites/'),
  15. chunkFilename: 'doc/js/[name].[hash:5].js',
  16. filename: isDev ? 'doc/js/[name].js' : 'doc/js/[name].[hash].js'
  17. },
  18. module: {
  19. rules: [
  20. ]
  21. },
  22. plugins: [
  23. new mdtohtml({
  24. entry:'./src',
  25. output:'./sites/doc/view/',
  26. template:'./doc-site/template.html',
  27. nav:'left' // left top right bottom
  28. }),
  29. new mdtohtml({
  30. entry:'./docs',
  31. output:'./sites/doc/page/',
  32. template:'./doc-site/template.html',
  33. nav:'left', // left top right bottom
  34. nohead:true
  35. }),
  36. new HtmlWebpackPlugin({
  37. template: './sites/doc/index.html',
  38. filename: 'default.html'
  39. }),
  40. new MiniCssExtractPlugin({
  41. filename: isDev ? 'doc/css/[name].css' : 'doc/css/[name].[hash].css'
  42. })
  43. ]
  44. });