UNPKG

@lynx-js/rspeedy

Version:

A webpack/rspack-based frontend toolchain for Lynx

37 lines (36 loc) 1.91 kB
export const __webpack_ids__ = [ "src_plugins_chunkLoading_plugin_ts" ]; export const __webpack_modules__ = { "./src/plugins/chunkLoading.plugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, { pluginChunkLoading: ()=>pluginChunkLoading }); var cache_events_webpack_plugin_ = __webpack_require__("@lynx-js/cache-events-webpack-plugin"); var chunk_loading_webpack_plugin_ = __webpack_require__("@lynx-js/chunk-loading-webpack-plugin"); function isLynx(environment) { return 'string' == typeof environment ? 'lynx' === environment : 'lynx' === environment.name; } var is_web = __webpack_require__("./src/utils/is-web.ts"); function pluginChunkLoading() { return { name: 'lynx:rsbuild:chunk-loading', setup (api) { api.modifyBundlerChain((chain, { environment })=>{ if ((0, is_web.$)(environment)) return void chain.output.chunkLoading("import-scripts").end(); if (isLynx(environment)) chain.plugin('lynx:chunk-loading').use(chunk_loading_webpack_plugin_.ChunkLoadingWebpackPlugin).end().plugin('lynx:cache-events').use(cache_events_webpack_plugin_.LynxCacheEventsPlugin).end().output.chunkLoading('lynx').chunkFormat('commonjs').end(); }); } }; } }, "./src/utils/is-web.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.d(__webpack_exports__, { $: ()=>isWeb }); function isWeb(environment) { return 'string' == typeof environment ? 'web' === environment : 'web' === environment.name; } } };