Skip to content
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

[SurveyCreator/React] - Bug with importing CSS styles #9582

Open
xsevcika2 opened this issue Mar 10, 2025 · 1 comment
Open

[SurveyCreator/React] - Bug with importing CSS styles #9582

xsevcika2 opened this issue Mar 10, 2025 · 1 comment
Assignees

Comments

@xsevcika2
Copy link

Describe the bug

I'm trying to import CSS styles for React Form Builder, and I found a few bugs in the documentation. I'm following the steps from the documentation here: https://surveyjs.io/survey-creator/documentation/get-started-react#install-the-survey-creator-react-npm-package

Steps to reproduce

  1. Install the library:
npm install survey-creator-react --save
  1. Import Survey Creator and SurveyJS Form Library style sheets
import "survey-core/survey-core.min.css";
import "survey-creator-core/survey-creator-core.min.css";
  1. CSS imports give the following error: 'survey-core' should be listed in the project's dependencies.
    *(The installation of npm install survey-creator-react --save didn't install survey-creator-core as a dependency)

  2. Install the following dependencies manually:

npm install survey-core survey-creator-core --save
  1. Error during compilation shows:
Module not found: Error: Package path ./survey-core.css is not exported from package /usr/src/app/node_modules/survey-core (see exports field in /usr/src/app/node_modules/survey-core/package.json)

Module not found: Error: Package path ./survey-creator-core.min.css is not exported from package /usr/src/app/node_modules/survey-creator-core (see exports field in /usr/src/app/node_modules/survey-creator-core/package.json)

Expected behavior
After installing npm install survey-creator-react --save and importing styles, the survey creator will function without additional modifications.

Temporary solution
I've manually added the export to survey-core/package.json

"exports": {
...
"./survey-core.css": "./survey-core.css", // Explicitly export survey-core.css
...
},

and also same for the survey-creator-core/package.json

"exports": {
...
"./survey-creator-core.min.css": "./survey-creator-core.min.css", // Explicitly exported
...
},

I'm not sure why I need these explicit exports when I can clearly see the global *.css export. But it won't work without them for me.

"exports": {
...
./*.css": "./*.css",
...
}

Please complete the following information:

  • Browser: Microsoft Edge
  • Browser version: Version 134.0.3124.51 (Official build) (64-bit)
  • JS framework/library: React + TS
  • SurveyJS version: v2.0.0
  • Device: PC
@JaneSjs JaneSjs self-assigned this Mar 12, 2025
@JaneSjs
Copy link
Contributor

JaneSjs commented Mar 22, 2025

Hi @xsevcika2,
I would appreciatre it if you share a reproducible demo and specify the NodeJS version you're using.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants