@shuvi/dll
TypeScript icon, indicating that this package has built-in type declarations

0.0.1-pre.6 • Public • Published

Dynamic DLL

update webpack development compiled speed

Steps

  1. 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
      });
  2. server static files of Dynamic DLL build

    connect middleware type

    dynamicDll.middleware = async (req: IncomingMessage, res: ServerResponse, next: (...args: any[]) => any){
        // ...
    }
  3. set specific depConfig config what will be use Dynamic DLL's webpack

    const depConfig = {};
    depConfig.module={
        // ...
    }
    depConfig.plugins={
        // ...
    }
        // ...
    dynamicDll.depConfig = depConfig; // at last
  4. modifyWebpackChain by dynamicDll.modifyWebpack or dynamicDll.modifyWebpackChain if you use WebpackChain

    const config = dynamicDll.modifyWebpack(orignalConfig);
     chain = await dynamicDll.modifyWebpackChain(chain, resolveEntryFile)
  5. make sure webpack entry is dynamic-entry

    1. 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")',
      }
    ])

Readme

Keywords

none

Package Sidebar

Install

npm i @shuvi/dll

Weekly Downloads

1

Version

0.0.1-pre.6

License

MIT

Unpacked Size

50.5 kB

Total Files

31

Last publish

Collaborators

  • wangjinyang666
  • liximomo