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' }
       },
     },
   }),
 ],
};
除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。