cssbundling-rails
cssbundling-rails copied to clipboard
Propshaft unable to find assets installed via yarn
I upgraded my rails from sprockets to propshaft. When compiling assets I'm getting an error saying files cannot be found for anything installed via yarn.
error
✗ yarn build:css
Error: Can't find stylesheet to import.
╷
1 │ @import "bootstrap/scss/bootstrap";
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^
╵
app/assets/stylesheets/application.bootstrap.scss
@import "bootstrap/scss/bootstrap";
@import "bootstrap-icons/font/bootstrap-icons";
.pnp.cjs
"packageRegistryData": [\
[null, [\
[null, {\
"packageLocation": "./",\
"packageDependencies": [\
["@ladjs/bootstrap-social", "git+ssh://[email protected]/niftylettuce/bootstrap-social.git#commit=f7d456c7982cdd865a8ac75025a5e68b4c71c925"],\
["@popperjs/core", "npm:2.11.8"],\
["@rails/actioncable", "npm:7.0.6"],\
["@rails/activestorage", "npm:7.0.6"],\
["@rails/ujs", "npm:7.0.6"],\
["@rails/webpacker", "npm:5.4.4"],\
["autoprefixer", "virtual:d95f65753489d049152fe4314b59c02da89739d38f62de0f1c0235045e704bb6949747c4774f8b30e11e5315307fea5ec44dc7b1cc4e6f353c11411f97c7bcff#npm:10.4.15"],\
["autosize", "npm:4.0.4"],\
["bootstrap", "virtual:d95f65753489d049152fe4314b59c02da89739d38f62de0f1c0235045e704bb6949747c4774f8b30e11e5315307fea5ec44dc7b1cc4e6f353c11411f97c7bcff#npm:5.3.1"],\
["bootstrap-icons", "npm:1.10.5"],\
["bootstrap-notifications", "npm:1.0.3"],\
["bootstrap-notify", "npm:3.1.3"],\
["bootstrap-reboot", "npm:4.5.6"],\
i have the same error on a new rails 7 app
Ran into this issue today. cssbundling-rails
seems to not know about Yarn 4's Plug n Play default node linker. I changed this to the node-modules
option and got this to pass. I'll watch this issue to see if there are any updates for supporting the Yarn PNP linker.
Here's the line to add to the .yarnrc.yml
file if you're interested in doing the same:
nodeLinker: node-modules