For AI agents: the complete documentation index is available at /zh/llms.txt, the full documentation bundle is available at /zh/llms-full.txt, and this page is available as Markdown at /zh/api/externals-loading-webpack-plugin.externalsloadingpluginoptions.externals.md.
这是开发预览网站。请访问正式文档 lynxjs.org

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' }
       },
     },
   }),
 ],
};