webpack.dll.config.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const path = require('path');
  2. const webpack = require('webpack');
  3. const MiniCssExtractPlugin = require("mini-css-extract-plugin");
  4. const config = require('../new-config.json');
  5. const webpackBaseConfig = require('./webpack.base.config');
  6. let rules = webpackBaseConfig.module.rules
  7. let projectPath = path.join(__dirname, '../')
  8. let entry = config['dll-entry'].entry.map((item) => {
  9. return path.join(projectPath, item);
  10. });
  11. module.exports = {
  12. mode: 'development',
  13. entry: {
  14. vendor: entry
  15. },
  16. watch: config['dll-entry'].watch,
  17. externals: {
  18. 'react': 'React',
  19. 'react-dom': 'ReactDOM',
  20. 'react-router': 'ReactRouter',
  21. 'redux': 'Redux',
  22. 'react-redux': 'ReactRedux',
  23. 'axios': 'axios',
  24. 'nc-lightapp-front': 'nc-lightapp-front',
  25. 'nc-report': 'nc-report',
  26. 'nc-hr-report': 'nc-hr-report'
  27. },
  28. output: {
  29. path: path.join(__dirname, '../dist/hrpub/dll'),
  30. filename: '[name].js',
  31. library: '[name]_[hash]_library'
  32. },
  33. module: {
  34. rules,
  35. },
  36. plugins: [
  37. // new MiniCssExtractPlugin({
  38. // filename: '[name].css'
  39. // }),
  40. new webpack.DllPlugin({
  41. path: path.join(__dirname, '../dist/hrpub/dll/[name]-manifest.json'),
  42. name: '[name]_[hash]_library'
  43. })
  44. ].concat(webpackBaseConfig.plugins)
  45. };