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 = [
115
115
[ gitignoreFile , "Git configuration that excludes compiled binaries from source control." ] ,
116
116
[ asconfigFile , "Configuration file defining both a 'debug' and a 'release' target." ] ,
117
117
[ 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." ] ,
119
119
[ indexHtmlFile , "Starter HTML file that loads the module in a browser." ]
120
120
] ;
121
121
122
122
const formatPath = filePath => "./" + path . relative ( projectDir , filePath ) . replace ( / \\ / g, "/" ) ;
123
123
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
+
124
135
console . log ( [
125
136
"Version: " + version ,
126
137
"" ,
You can’t perform that action at this time.
0 commit comments