File tree Expand file tree Collapse file tree 1 file changed +24
-19
lines changed
Expand file tree Collapse file tree 1 file changed +24
-19
lines changed Original file line number Diff line number Diff line change @@ -117,33 +117,38 @@ class WasmPackPlugin {
117117 _compile ( watching ) {
118118 info ( `ℹ️ Compiling your crate in ${ this . isDebug ? 'development' : 'release' } mode...\n` ) ;
119119
120- return spawnWasmPack ( {
120+ return fs . promises . stat ( this . crateDirectory ) . then ( stats => {
121+ if ( ! stats . isDirectory ( ) ) {
122+ throw new Error ( `${ this . crateDirectory } is not a directory` ) ;
123+ }
124+ } ) . then ( ( ) => {
125+ return spawnWasmPack ( {
121126 outDir : this . outDir ,
122127 outName : this . outName ,
123128 isDebug : this . isDebug ,
124129 cwd : this . crateDirectory ,
125130 extraArgs : this . extraArgs ,
126- } )
127- . then ( ( detail ) => {
128- // This clears out the error when the compilation succeeds.
129- this . error = null ;
131+ } ) ;
132+ } ) . then ( ( detail ) => {
133+ // This clears out the error when the compilation succeeds.
134+ this . error = null ;
130135
131- if ( detail ) {
132- info ( detail ) ;
133- }
136+ if ( detail ) {
137+ info ( detail ) ;
138+ }
134139
135- info ( '✅ Your crate has been correctly compiled\n' ) ;
136- } )
137- . catch ( ( e ) => {
138- // Webpack has a custom error system, so we cannot return an
139- // error directly, instead we need to trigger it later.
140- this . error = e ;
140+ info ( '✅ Your crate has been correctly compiled\n' ) ;
141+ } )
142+ . catch ( ( e ) => {
143+ // Webpack has a custom error system, so we cannot return an
144+ // error directly, instead we need to trigger it later.
145+ this . error = e ;
141146
142- if ( watching ) {
143- // This is to trigger a recompilation so it displays the error message
144- this . _makeEmpty ( ) ;
145- }
146- } ) ;
147+ if ( watching ) {
148+ // This is to trigger a recompilation so it displays the error message
149+ this . _makeEmpty ( ) ;
150+ }
151+ } ) ;
147152 }
148153}
149154
You can’t perform that action at this time.
0 commit comments