@shuvi/dll
v0.0.1-pre.6
Published
update webpack development compiled speed
Downloads
7
Readme
Dynamic DLL
update webpack development compiled speed
Steps
new a DynamicDll
const dynamicDll = new DynamicDll({ cwd: process.cwd(), // the root dir of your app webpackLib: webpack, // webpack webpackPath: '', // webpackpath default '' tmpBase: join(cwd, DEFAULT_TMP_DIR_NAME), // Dynamic DLL files dir includesLibs, // the libary you want include excludeLibs, // the libary you want exclude shared, // mf shared of Dynamic DLL });
server static files of Dynamic DLL build
dynamicDll.middleware = async (req: IncomingMessage, res: ServerResponse, next: (...args: any[]) => any){ // ... }
set specific depConfig config what will be use Dynamic DLL's webpack
const depConfig = {}; depConfig.module={ // ... } depConfig.plugins={ // ... } // ... dynamicDll.depConfig = depConfig; // at last
modifyWebpackChain by dynamicDll.modifyWebpack or dynamicDll.modifyWebpackChain if you use WebpackChain
const config = dynamicDll.modifyWebpack(orignalConfig);
chain = await dynamicDll.modifyWebpackChain(chain, resolveEntryFile)
make sure webpack entry is dynamic-entry
- config with webpack chain can do this step by webpack-virtual-modules
// origin config { entry:{ main: 'index.js' } } // webpack chain chain.plugin('dll-virtual-modules-plugin').use(VirtualModulesPlugin,[ { './virtual-modules.js': 'import ("index.js")', } ])