mirror of https://github.com/alibaba/ice.git
fix: miniapp using absolute path to match route manifest
This commit is contained in:
parent
182929cac0
commit
820efdf41d
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@ice/plugin-miniapp': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: miniapp using absolute path to match route manifest
|
|
@ -10,6 +10,7 @@ import loaderUtils from '@ice/bundles/compiled/loader-utils/index.js';
|
||||||
import type { Compilation, Compiler } from '@ice/bundles/compiled/webpack/index.js';
|
import type { Compilation, Compiler } from '@ice/bundles/compiled/webpack/index.js';
|
||||||
import EntryDependency from '@ice/bundles/compiled/webpack/EntryDependency.js';
|
import EntryDependency from '@ice/bundles/compiled/webpack/EntryDependency.js';
|
||||||
|
|
||||||
|
import type { NestedRouteManifest } from '@ice/route-manifest';
|
||||||
import SingleEntryDependency from '../dependencies/SingleEntryDependency.js';
|
import SingleEntryDependency from '../dependencies/SingleEntryDependency.js';
|
||||||
import { componentConfig } from '../utils/component.js';
|
import { componentConfig } from '../utils/component.js';
|
||||||
|
|
||||||
|
@ -93,7 +94,7 @@ export default class MiniPlugin {
|
||||||
appConfig: MiniappAppConfig;
|
appConfig: MiniappAppConfig;
|
||||||
/** app、页面、组件的配置集合 */
|
/** app、页面、组件的配置集合 */
|
||||||
filesConfig: IMiniFilesConfig = {};
|
filesConfig: IMiniFilesConfig = {};
|
||||||
routeManifest: Record<string, any>[] = [];
|
routeManifest: NestedRouteManifest[] = [];
|
||||||
isWatch = false;
|
isWatch = false;
|
||||||
/** 页面列表 */
|
/** 页面列表 */
|
||||||
pages = new Set<IComponent>();
|
pages = new Set<IComponent>();
|
||||||
|
@ -162,7 +163,7 @@ export default class MiniPlugin {
|
||||||
this.context = compiler.context;
|
this.context = compiler.context;
|
||||||
this.appEntry = this.getAppEntry(compiler);
|
this.appEntry = this.getAppEntry(compiler);
|
||||||
|
|
||||||
const { commonChunks, combination, framework, isBuildPlugin, newBlended } = this.options;
|
const { commonChunks, combination, framework, isBuildPlugin, newBlended, sourceDir } = this.options;
|
||||||
|
|
||||||
const { addChunkPages, onCompilerMake, modifyBuildAssets, onParseCreateElement } = combination.config;
|
const { addChunkPages, onCompilerMake, modifyBuildAssets, onParseCreateElement } = combination.config;
|
||||||
|
|
||||||
|
@ -281,7 +282,7 @@ export default class MiniPlugin {
|
||||||
: this.pageLoaderName;
|
: this.pageLoaderName;
|
||||||
|
|
||||||
if (!isLoaderExist(module.loaders, loaderName)) {
|
if (!isLoaderExist(module.loaders, loaderName)) {
|
||||||
const routeInfo = this.routeManifest.find(route => path.join('pages', route.id) === module.name);
|
const routeInfo = this.routeManifest.find(route => path.join(sourceDir, 'pages', route.file) === module.resource);
|
||||||
const hasExportData = routeInfo?.exports?.includes('dataLoader');
|
const hasExportData = routeInfo?.exports?.includes('dataLoader');
|
||||||
const hasExportConfig = routeInfo?.exports?.includes('pageConfig');
|
const hasExportConfig = routeInfo?.exports?.includes('pageConfig');
|
||||||
module.loaders.unshift({
|
module.loaders.unshift({
|
||||||
|
|
Loading…
Reference in New Issue