Home > @lynx-js/externals-loading-webpack-plugin > ExternalsLoadingPluginOptions > externals

ExternalsLoadingPluginOptions.externals property

Specify the externals to be loaded. The externals should be Lynx Bundles.

Signature:

externals: Record<string, ExternalValue>;

Example 1

Load lodash library in background layer and main-thread layer.

module.exports = {
 plugins: [
   new ExternalsLoadingPlugin({
     externals: {
       lodash: {
         url: 'http://lodash.lynx.bundle',
         background: { sectionPath: 'background' },
         mainThread: { sectionPath: 'mainThread' },
       },
     },
   }),
 ],
};

Example 2

Load lodash library only in background layer.

module.exports = {
 plugins: [
   new ExternalsLoadingPlugin({
     externals: {
       lodash: {
         url: 'http://lodash.lynx.bundle',
         background: { sectionPath: 'background' }
       },
     },
   }),
 ],
};
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.