square / svelte-store

528 stars 35 forks source link

Issues after migration to v1 #40

Closed miedzikd closed 2 years ago

miedzikd commented 2 years ago

After migration to v1 I got some warnings and errors... webpack can't compile page now ;/

 WARN  Compiled with 3 warnings                                                                                                                                                                            
 warn  in ./assets/svelte/apps/x1/stores/authMethodsStore.ts                                                                                                                                     
export 'asyncDerived' (imported as 'asyncDerived') was not found in '@square/svelte-store' (possible exports: get)

 warn  in ./assets/svelte/apps/x1/stores/configStore.ts                                                                                                                                          
export 'asyncReadable' (imported as 'asyncReadable') was not found in '@square/svelte-store' (possible exports: get)

 warn  in ./assets/svelte/apps/x1/stores/userStore.ts                                                                                                                                           
export 'persisted' (imported as 'persisted') was not found in '@square/svelte-store' (possible exports: get)

 ERROR  Failed to compile with 5 errors                                                                                                                                                                   

Module build failed: Module not found:
"./node_modules/@square/svelte-store/lib/index.js" contains a reference to the file "./async-client".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@square/svelte-store/lib/index.js" contains a reference to the file "./async-stores".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@square/svelte-store/lib/index.js" contains a reference to the file "./persisted".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@square/svelte-store/lib/index.js" contains a reference to the file "./standard-stores".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@square/svelte-store/lib/index.js" contains a reference to the file "./utils".
This file can not be found, please check it for typos or update it if the file got moved.

webpack compiled with 5 errors and 3 warnings

Any tips?

Akolyte01 commented 2 years ago

Can you post more details about your environment, settings, and how you are attempting to import? Beyond that try clearing your node modules and reeinstalling

miedzikd commented 2 years ago

OK I found reason... We are using webpack and webpack 5 have change the way it builds the project dependencies https://webpack.js.org/configuration/module/#resolvefullyspecified

When package.json contains a field of "type" with the value of "module" , webpack requires a full path(including the file extension, like .js/.mjs),otherwise webpack would fail the compiling with a Module not found error. Setting fullySpecified to false disables this behavior.