Skip to content

Commit

Permalink
fix: Cannot find module '@@/core/umiExports', when use defineConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohuoni committed Aug 31, 2021
1 parent 90f38c5 commit f980f58
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/alita/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
let ex = require('./lib/cjs');
try {
const umiExports = require('@@/core/umiExports');
ex = Object.assign(ex, umiExports);
} catch (e) {}
module.exports = ex;
3 changes: 2 additions & 1 deletion packages/alita/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "alita",
"version": "2.8.18",
"description": "umi 移动端方案插件集合",
"main": "lib/index.js",
"main": "index.js",
"module": "dist/index.esm.js",
"types": "types.d.ts",
"bin": {
Expand Down Expand Up @@ -33,6 +33,7 @@
},
"dependencies": {
"@alitajs/umi-presets-alita": "2.8.18",
"@umijs/types": "3.5.17",
"umi": "3.5.17"
}
}
3 changes: 3 additions & 0 deletions packages/alita/src/cjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineConfig } from './defineConfig';

export { defineConfig };
10 changes: 10 additions & 0 deletions packages/alita/src/defineConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// @ts-ignore
import { IConfigFromPlugins } from '@@/core/pluginConfig';
import { IConfig } from '@umijs/types';

// IConfig types is prior to IConfigFromPlugins in the same key.
export function defineConfig(
config: IConfigFromPlugins | IConfig,
): IConfigFromPlugins | IConfig {
return config;
}

0 comments on commit f980f58

Please sign in to comment.