Specifying external limitations

You may work with libraries that use several files from a dependency, such as in the following descriptive block:

  • import A from 'library/one';
  • import B from 'library/two';

In this case, they can't be excluded from the bundle by specifying the library in the externals. They would need to be excluded one at a time or by using a regular expression, such as with the following example:

module.exports = {
externals: [
'library/one',
'library/two',
// Everything that starts with "library/"
/^library/.+$/
]
};

Once that is accomplished, we need to expose the library or allow it to be loaded into our frontend. This is covered in the next subsection.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.173.112