-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latest versions fail #1046
Comments
@avoinea : Thank you for letting us know. We will investigate and get back to you soon. |
@avoinea : We do not recommend importing directly from the files |
Hi! This has broken our build due to an automerge rule from our renovate tool. Currently using import APIConnector from "@elastic/search-ui-elasticsearch-connector"; According to https://docs.elastic.co/search-ui/api/connectors/elasticsearch Resulting in:- Has this import to be changed? Concerned a patch semver change between 1.21.2 and 1.21.3 has knackered our build:- We'll pin this on 1.21.2 for now! |
Hi there, We recently introduced an update where we declared exports within the package json. (#1043). We made this change as a patch as it should of been backwards compatible and was addressing a bug with it not able to be used by libraries which rely on ESM imports (#1043). However this change may have impacted those who bundlers that now using the @gaving could you give me more context on your setup? How is your code bundled? nextjs / CRA etc. Will try replicate on my end. Joe |
Hi @joemcelroy - Thanks for the quick response. Nothing too complicated it seems to reproduce:-
npm i --save '@elastic/search-ui-elasticsearch-connector' Add "type": "module" to package.json index.js import APIConnector from "@elastic/search-ui-elasticsearch-connector"; ❯ node index.js
(node:20790) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/tmp/test_build/index.js:1
import APIConnector from "@elastic/search-ui-elasticsearch-connector";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1274:20)
at Module._compile (node:internal/modules/cjs/loader:1320:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Module.load (node:internal/modules/cjs/loader:1197:32)
at Module._load (node:internal/modules/cjs/loader:1013:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)
at node:internal/main/run_main_module:28:49
Node.js v18.19.1 Verified on Node 20.13.1 too for what it's worth. |
Thanks. Will follow what we did in Searchkit where the file extension is mjs. |
Update: This is becoming a little more difficult to do as now issue arises downstream due to searchkit not esm compatible yet. We are planning on removing searchkit as a dependency in the upcoming GAing. For now use 1.20.1 @gaving - i dont want to create additional issues arising from making further changes. We will address this properly soon as we evaluate dependencies and ESM compatibility. |
@avoinea in 1.21.5, you can now access helpers via
|
Funnily enough our CI just bumped, tested & merged 1.21.5 automatically? All appears good this side! |
Ah sorry, disregard - that was |
just to highlight - this is an issue if you're using node directly, without a transpile step like typescript or vite. These transpilers handle different resolution strategies for dependencies so depending on your build setup, it may work fine. |
Pinning version to 1.21.2 fixed the issue for me.
The text was updated successfully, but these errors were encountered: