import * as webpack from 'webpack'; import * as path from 'path'; import { CleanWebpackPlugin } from "clean-webpack-plugin"; import { outputDir } from './outputPath'; const dllName = "dll"; const vendors = [ "@blueprintjs/core", "@blueprintjs/icons", "mobx", "mobx-react", "react", "react-color", "react-dom", "react-rnd", "stats.js", "pako", "monotone-convex-hull-2d", "dxf-parser-2", "xaop", "react-split", "js-angusj-clipper/web", "react-window", //如果你想调试threejs的代码,那么你应该注释掉下面的代码,然后重新构建dll "three", "three/examples/jsm/loaders/FBXLoader", "three/examples/jsm/postprocessing/EffectComposer", "three/examples/jsm/postprocessing/Pass", "three/examples/jsm/shaders/CopyShader", "three/examples/jsm/postprocessing/RenderPass", "three/examples/jsm/postprocessing/SMAAPass", "three/examples/jsm/renderers/SVGRenderer.js", "three/examples/jsm/helpers/RectAreaLightHelper", "three/examples/jsm//lines/LineMaterial", "three/examples/jsm/lines/LineGeometry", "three/examples/jsm/lines/Line2", ]; const config: webpack.Configuration = { mode: "production", output: { path: path.resolve(__dirname, outputDir), filename: "[hash].dll.js", library: dllName, }, devtool: "source-map", entry: { "lib": vendors, }, plugins: [ new webpack.DllPlugin({ path: path.resolve(__dirname, `${outputDir}manifest.json`), name: dllName, context: __dirname, }), new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: ["*.dll.js", "*.dll.js.map"] }), ], }; export default config;