Closed shaack closed 1 year ago
Hi, which version?
"cm-chessboard": "^6.0.2",
My guess is that the package.json in the library is only exposing Chessboard and not the extensions, but I'm not sure if that's the real issue and how to solve it.
in cm-chessboard package.json:
"module": "./src/cm-chessboard/Chessboard.js",
But no references to the extension modules.
This might be related:
https://stackoverflow.com/questions/44345257/import-from-subfolder-of-npm-package
For me this looks mainly like an issue of the used transpiling software or of node.js, because in ES6 you have no imports like import { Chessboard, INPUT_EVENT_TYPE, COLOR } from 'cm-chessboard';
this is transpiling syntax or node.js-syntax. In ES6 you import files with its relative or absolute path and extension (".js").
See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import?retiredLocale=de "[..] The module to import from. The evaluation of the specifier is host-specified. This is often a relative or absolute URL to the .js file containing the module. In Node, extension-less imports often refer to packages in node_modules. Certain bundlers may permit importing files without extensions; check your environment.."
If you find out, how it works with node.js or your transpiler/bundling software, I can add it to the package.json.
Ok, I'll try to figure it out and let you know, thank you!
Nice, thank you. (And I should rename this Issue) 😉
Is this still an issue? I used to have this problem (cm-chessboard v4) but this week I upgraded to take advantage of new v7 features and I am also now able to import from NodeJS without any problems. I am not using all the extensions though, only Markers, PromotionDialog, and a couple custom extensions.
I don't think so and will close the ticket.
Hello! Could you explane please. Why import fron line 25 is working, but on 26 - not?
@Ivanov-Igor-V What do you mean with "is not working". Is there a failure or an exception? Do you use a framework or transpiling software?
@Ivanov-Igor-V What do you mean with "is not working". Is there a failure or an exception? Do you use a framework or transpiling software?
i'm sorry its just misspelling in a word extensions
Hi, is the package.json properly updated? My project fails to resolve the import of the markers:
This works:
but the following fails
I think it might be related to the package.json of the npm published library.
Thank you for the support!