jessuni / shikwasa

An audio player born for podcast
https://shikwasa.js.org
MIT License
476 stars 30 forks source link

cannot import css in `v2.2.0` #72

Closed IvanWoo closed 1 year ago

IvanWoo commented 1 year ago

greetings!

I am trying to upgrade shikwasa to v2.2.0 at here, but I noticed that the css file cannot be imported properly with the following error msg

import "shikwasa/dist/style.css";
import { Chapter, Player } from "shikwasa";

...
...
ERROR in ./src/podcastPlayer/index.js 1:0-33
[30](https://github.com/IvanWoo/subjpop.github.io/actions/runs/4157082134/jobs/7191312599#step:7:31)
Module not found: Error: Package path ./dist/style.css is not exported from package /home/runner/work/subjpop.github.io/subjpop.github.io/node_modules/shikwasa (see exports field in /home/runner/work/subjpop.github.io/subjpop.github.io/node_modules/shikwasa/package.json)
[31](https://github.com/IvanWoo/subjpop.github.io/actions/runs/4157082134/jobs/7191312599#step:7:32)
 @ ./src/index.js 5:0-50 11:2-21

seems like it's related to the exports field of package.json

https://github.com/jessuni/shikwasa/blob/ecf7a3e3e607540b53aa3beb54a366641ea577c3/package.json#L10-L14

I can import the css after removing the exports part based on the discussion at here

I don't mind opening a pr for it, but not sure if it's the right way going forward b/c it might break commonjs import

thanks!

jessuni commented 1 year ago

Sorry for the trouble caused and thanks for the suggestion!

According to the Node.js documentation, this is caused by the encapsulation effect of exports. I'll add a subpath export for the stylesheet and it should fix. I'll publish the fix soon after running some tests to make sure all builds work.