webpack-dynamic-require
TypeScript icon, indicating that this package has built-in type declarations

2.0.6 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i webpack-dynamic-require

Weekly Downloads

14

Version

2.0.6

License

MIT

Unpacked Size

87.4 kB

Total Files

16

Last publish

Collaborators

  • blueair