bouzidanas / react-reveal-slides

Create and add reveal.js presentations in react
MIT License
17 stars 1 forks source link

Installing from GitHub does not bundle the package (install + build) #2

Open davelsan opened 2 months ago

davelsan commented 2 months ago

On a new project, just copy-pasted the example in the README and got the following error when running pnpm dev.

Could not resolve import("../node_modules/reveal.js/dist/theme/**/*.css")

    node_modules/.pnpm/github.com+bouzidanas+react-reveal-slides@3e0a0a560b8babbe1897c95c758cb9a9eacfb8a1/node_modules/react-reveal-slides/src/Reveal.tsx:492:15:
      492 │         import(`../node_modules/reveal.js/dist/theme/${theme}.css`)
          ╵                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

It seems installing from GitHub does not bundle the package. I've also tried with npm and it leads to the same outcome. Is it possible that I'm missing something? Normally, I would expect the package manager to handle the install and build step.

As a workaround, I added a postinstall script to my package.json, but it's not ideal and the docs do not suggest this is necessary.

"postinstall": "cd ./node_modules/react-reveal-slides && npm i && npm run build"

Relevant dependencies:

"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-reveal-slides": "github:bouzidanas/react-reveal-slides",
"reveal.js": "^5.1.0"
"typescript": "^5.2.2",
"vite": "^5.2.0"
bouzidanas commented 2 months ago

Hi davelsan,

I am currently working on things in this repo so somethings may have changed. Can you remove the plugin imports from the example and also remove plugins={[RevealZoom, RevealNotes]} and see if it runs.

Your result is confusing because I used this component in another project of mine called content-to-cards and it all works with no such problems.

If the issue persists, I will add a quick test to the project and see what comes out of that.

bouzidanas commented 2 months ago

Hello again,

So I was correct in that the issue is related to a recent change I made.

While I work on a fix, you should be able to get the example working if you change the package install command from

npm install reveal.js bouzidanas/react-reveal-slides 

to the following

npm install reveal.js bouzidanas/react-reveal-slides#slide-vstack-background-fix

I should mention that you will need to put <RevealSlides> component in a container div that has a height and a width. Otherwise you will not see the slides (because they will have dimensions 0x0)

davelsan commented 2 months ago

Hey!

Thanks for the quick reply. Good that you found the issue and fix.

Yep, I noticed the container dimensions issue, but that is hinted at in the docs so it's all good.

I've noticed a few other things too, but I'll open a different issue so you can keep track of things.