Closed avoinea closed 3 months ago
@avoinea : Thank you for letting us know. We will investigate and get back to you soon.
@avoinea : Can you provide more details on the error and/or how to reproduce the issue (preferably a link to Codesandbox
)? I have successfully run a sample application with the latest version defined in here.
@Samiul-TheSoccerFan https://github.com/eea/eea-website-frontend/tree/develop
@avoinea : We do not recommend importing directly from the files import { removeSingleFilterValue } from '@elastic/search-ui/lib/cjs/helpers';
. It might create issues in the long run such as moving the interfaces or files into a different location.
Hi!
This has broken our build due to an automerge rule from our renovate tool.
Currently using search-ui-elasticsearch-connector
like so:-
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:-
https://github.com/elastic/search-ui/compare/v1.21.2...v1.21.3
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. (https://github.com/elastic/search-ui/pull/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 (https://github.com/elastic/search-ui/pull/1043).
However this change may have impacted those who bundlers that now using the exports
path and having issues now with loading search-ui with ESM.
@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:-
❯ node --version
v18.19.1
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
import { ViewHelpers } from '@elastic/react-search-ui-views';
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.
Funnily enough our CI just bumped, tested & merged 1.21.5 automatically? All appears good this side!
Ah sorry, disregard - that was @elastic/react-search-ui
, the connector is still broke.
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.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Is this issue still important to you? If so, please leave a comment and let us know. As always, thank you for your contributions.
Is this issue still important to you? If so, please leave a comment and let us know. As always, thank you for your contributions.
This issue is still important to us!
Just to be clear, is this definitely a wontfix
?
Running a server side service with:-
import APIConnector from "@elastic/search-ui-elasticsearch-connector";
Isn't possible to be run using node directly?
Just unsure if there's a suggested workaround is (i.e. without transpiling).
Pinning version to 1.21.2 fixed the issue for me.