elastic/search-ui

Missing "./lib/styles/styles.css" specifier in "@elastic/react-search-ui-views" package

Closed this issue · 4 comments

Hi all,

maybe a bug?

Bug description
Since version 1.21.3 we get the following error message while yarn build. The version 1.21.2 is working fine.

Error message

Error message on local developer machine with Node 20

X [ERROR] Missing "./lib/esm/view-helpers" specifier in "@elastic/react-search-ui-views" package [plugin vite:dep-scan] src/components/search/pagingView/PagingView.tsx:4:32: 4 ¦ ...sName } from '@elastic/react-search-ui-views/lib/esm/view-helpers';

Error message on GitLab Ci pipeline with Node 18.19 and 22.2

Error: [commonjs--resolver] Missing "./lib/esm/view-helpers" specifier in "@elastic/react-search-ui-views" package at e (file:///builds/<secretpath>/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:47597:25) at n (file:///builds/<secretpath>/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:47597:627) at o (file:///builds/<secretpath>/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:47597:1297) at resolveExportsOrImports (file:///builds/<secretpath>/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:48287:20) at resolveDeepImport (file:///builds/<secretpath>/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:48306:31) at tryNodeResolve (file:///builds/<secretpath>/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:48031:20) at Object.resolveId (file:///builds/<secretpath>/node_modules/vite/dist/node/chunks/dep-cNe07EU9.js:47781:28) at file:///builds/<secretpath>/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:19774:40 at async PluginDriver.hookFirstAndGetPlugin (file:///builds/<secretpath>/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:19674:28) at async resolveId (file:///builds/<secretpath>/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:18355:26) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Cleaning up project directory and file based variables 00:00 ERROR: Job failed: exit code 1

To Reproduce
Steps to reproduce the behavior:

  1. use package.json with following dependencies
    "dependencies": { "@elastic/react-search-ui": "1.21.3", "@elastic/react-search-ui-views": "1.21.3", "@elastic/search-ui-app-search-connector": "1.21.3", "@elastic/search-ui-engines-connector": "1.21.3",
  2. yarn install
  3. yarn build

Expected behavior
No build error as for 1.21.2

Which backends and packages are you using:
Backend: App Search, Elasticsearch, Node, NGINX

Packages:

It doesnt work for 1.21.3 and 1.21.4

"dependencies": { "@elastic/react-search-ui": "1.21.3", "@elastic/react-search-ui-views": "1.21.3", "@elastic/search-ui-app-search-connector": "1.21.3", "@elastic/search-ui-engines-connector": "1.21.3", "@emotion/react": "^11.11.4", "@emotion/styled": "^11.11.5", "@fontsource/bebas-neue": "^5.0.20", "@fontsource/pt-sans": "^5.0.13", "@mui/icons-material": "^5.15.16", "@mui/material": "^5.15.16", "@mui/styled-engine-sc": "^5.14.12", "@mui/styles": "^5.15.16", "@reduxjs/toolkit": "^2.2.3", "i18next": "^23.11.3", "jwt-decode": "^4.0.0", "oidc-client-ts": "^3.0.1", "rc-pagination": "^4.0.4", "react": "^18.3.1", "react-dom": "^18.3.1", "react-i18next": "^14.1.1", "react-markdown": "^9.0.1", "react-oidc-context": "^3.1.0", "react-redux": "^9.1.2", "react-router-dom": "^6.23.0", "react-scripts": "^5.0.1", "rehype-raw": "^7.0.0", "styled-components": "^6.1.9", "vite-plugin-svgr": "^4.2.0"

hmm we should of addressed this in 1.21.4 with this change https://github.com/elastic/search-ui/pull/1045/files.

Looking at the error, its complaining about ./lib/esm/view-helpers. Are you directly importing any functions from the library?

Yes we are using

import { appendClassName } from '@elastic/react-search-ui-views/lib/esm/view-helpers';

om one our tsx pages

try removing that (copy the fn) and see if it works. We will need to create a export path for these view helpers long term.

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.