Skip to content

lokewei/webpack-dynamic-require

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack Dynamic Require

/**
 * @param name
 * @param baseUrl
 * @param hashed
 */
import DynamicRequire from 'webpack-dynamic-require';

const dr = new DynamicRequire({
  baseUrl: 'http://127.0.0.1:3333',
  hashed: true
});


// xxxx = lib name in package.json
dr.require('xxxx').then((Comp) => {
  console.log(Comp);
  // ReactDOM.render(<Comp />, document.getElementById('#id'));
});

// uninstall assets

dr.uninsall();

hashed is now can be used with webpack-named-moduleids-plugin

About

you can require cdn bundle dynamic

Resources

License

Stars

Watchers

Forks

Packages

No packages published