File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -115,12 +115,23 @@ const paths = [
115115 [ gitignoreFile , "Git configuration that excludes compiled binaries from source control." ] ,
116116 [ asconfigFile , "Configuration file defining both a 'debug' and a 'release' target." ] ,
117117 [ packageFile , "Package info containing the necessary commands to compile to WebAssembly." ] ,
118- [ testsIndexFile , "Stater test to check that the module is functioning." ] ,
118+ [ testsIndexFile , "Starter test to check that the module is functioning." ] ,
119119 [ indexHtmlFile , "Starter HTML file that loads the module in a browser." ]
120120] ;
121121
122122const formatPath = filePath => "./" + path . relative ( projectDir , filePath ) . replace ( / \\ / g, "/" ) ;
123123
124+ if ( fs . existsSync ( packageFile ) ) {
125+ const pkg = JSON . parse ( fs . readFileSync ( packageFile ) ) ;
126+ if ( "type" in pkg && pkg [ "type" ] !== "module" ) {
127+ console . error ( stdoutColors . red ( [
128+ `Error: The "type" field in ${ formatPath ( packageFile ) } is set to "${ pkg [ "type" ] } ".` ,
129+ ` asinit requires the "type" field to be set to "module" (ES modules).`
130+ ] . join ( "\n" ) ) ) ;
131+ process . exit ( 1 ) ;
132+ }
133+ }
134+
124135console . log ( [
125136 "Version: " + version ,
126137 "" ,
You can’t perform that action at this time.
0 commit comments