mymth / vanillajs-datepicker

A vanilla JavaScript remake of bootstrap-datepicker for Bulma and other CSS frameworks
MIT License
720 stars 147 forks source link

Sass resolution issue with webpack 5 (via shakapacker) #102

Closed tagliala closed 2 years ago

tagliala commented 2 years ago

Hi,

I'm experiencing an issue with a shakapacker build system based on webpack 5 when trying to import the scss file

@import "vanillajs-datepicker/sass/datepicker-bs5";

Error:

-- inner error --
Error: Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Can't find stylesheet to import.
  ╷
1 │ @import "vanillajs-datepicker/sass/datepicker-bs5";

This is caused by sass folder not being exported in exports package.json directive.

https://github.com/mymth/vanillajs-datepicker/blob/1c50bfcc70f016bf5373aa8f8ab08b9a1f8aed5b/package.json#L7-L13

Since I wasn't able to override a package.json dependency directive in my application, I've forked this repo and made a new branch here: https://github.com/tagliala/vanillajs-datepicker/tree/bugfix/export-sass

With my branch:

webpack 5.69.1 compiled successfully in 7385 ms

Versions and tools:

$ yarn --version
1.22.17

$ bin/webpacker --version
webpack: 5.69.1
webpack-cli: 4.9.2
webpack-dev-server 4.7.4

Providing a minimum reduced test case is possible, but it will require some time. Please let me know if it is needed

PS: I'm not a javasacript developer, so I do not know if there are side effects in adding sass folder to the exports

tagliala commented 2 years ago

Just realized this is a duplicate of #87, sorry