webpack.doc.base.conf.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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/md-to-other');
  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. path: path.resolve(__dirname, '../dist/sites/doc/'),
  14. chunkFilename: 'js/[name].[hash:5].js',
  15. filename: isDev ? 'js/[name].js' : 'js/[name].[hash].js'
  16. },
  17. module: {
  18. },
  19. plugins: [
  20. new mdtohtml({
  21. entry:'./src',
  22. output:'./sites/doc/view/',
  23. template:'./doc-site/template.html',
  24. nav:'left' // left top right bottom
  25. }),
  26. new mdtohtml({
  27. entry:'./docs',
  28. output:'./sites/doc/page/',
  29. template:'./doc-site/template.html',
  30. nav:'left', // left top right bottom
  31. nohead:true
  32. }),
  33. new HtmlWebpackPlugin({
  34. template: './sites/doc/index.html'
  35. }),
  36. new MiniCssExtractPlugin({
  37. filename: isDev ? 'css/[name].css' : 'css/[name].[hash].css'
  38. })
  39. ]
  40. });