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", "stats.js", "xaop", "react-rnd2", "dxf-parser", "pako", "monotone-convex-hull-2d", //如果你想调试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", ]; const config: webpack.Configuration = { mode: "production", output: { path: path.resolve(__dirname, outputDir), filename: "[hash].dll.js", library: dllName, }, entry: { "lib": vendors, }, plugins: [ new webpack.DllPlugin({ path: path.resolve(__dirname, `${outputDir}manifest.json`), name: dllName, context: __dirname, }), new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: ["*.dll.js"] }), ], }; export default config;