File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
packages/generator/generator-utils/src Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @modern-js/generator-utils ' : patch
3
+ ---
4
+
5
+ fix: generator get modern plugin version error
6
+
7
+ fix: 修复生成器获取插件版本错误
Original file line number Diff line number Diff line change @@ -98,11 +98,19 @@ export async function getModernPluginVersion(
98
98
return getLatetPluginVersion ( 'latest' ) ;
99
99
}
100
100
// get project solution version
101
- const pkgPath = path . join (
101
+ let pkgPath = path . join (
102
102
require . resolve ( SolutionToolsMap [ solution ] , { paths : [ cwd ] } ) ,
103
- '../../../../ ' ,
103
+ '../../..' ,
104
104
'package.json' ,
105
105
) ;
106
+ if ( solution === Solution . Module ) {
107
+ pkgPath = path . join (
108
+ require . resolve ( SolutionToolsMap [ solution ] , { paths : [ cwd ] } ) ,
109
+ '../..' ,
110
+ 'package.json' ,
111
+ ) ;
112
+ }
113
+
106
114
if ( fs . existsSync ( pkgPath ) ) {
107
115
const pkgInfo = fs . readJSONSync ( pkgPath ) ;
108
116
You can’t perform that action at this time.
0 commit comments