require.import

1.0.2 • Public • Published

require.import()

add require.import to your list of babel plugins.

usage

require.import('./script.js', (err, Module) => {
  // do stuff with Module
}, /* optional chunk name */)

why not import()/require.ensure()?

tl;dr - fixes this issue

when using with ssr

you need to make sure that you insert content into your html in the following order -

  • server side rendered html
  • main bundle
  • chunks required for the given html (use predictable chunk names to make this easier)
  • a snippet to start the whole app

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    5
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    5
  • 1.0.1
    3
  • 1.0.0
    3

Package Sidebar

Install

npm i require.import

Weekly Downloads

7

Version

1.0.2

License

MIT

Last publish

Collaborators

  • threepointone