Closed mischnic closed 4 years ago
@Ethan-Arrowood in a setup like this
.
âââ package.json
âââ src
â  âââ App.scss
â  âââ index.html
âââ yarn.lock
Both build and serve mode seem to work:
niklas@nmb:sass-pkg $ yarn parcel build src/index.html --no-cache
yarn run v1.22.4
$ parcel build src/index.html --no-cache
⨠Built in 16.19s
dist/index.html 286 B 6.94s
dist/App.40082c93.css 140.13 KB 6.86s
⨠Done in 18.19s.
niklas@nmb:sass-pkg $ yarn parcel src/index.html --no-cache
yarn run v1.22.4
$ parcel src/index.html --no-cache
âšī¸ Server running at http://localhost:1234
I was using npm. I was able to fix it by changing the path to @import "node_modules/bootstrap/scss/bootstrap";
Ya know, maybe it was an npm dependency issue. I'll see if removing node_modules and reinstalling fixes things. I'll update this issue with more later
Tested this and it works for me now. Must have been the cache or some lingering module. Thank you!
I've got the same issue, same error. I'm using yarn. Works under serve, but not under build.
This only happens with Bootstrap 5, what version were you testing @Ethan-Arrowood?
This is also happening with tailwindcss
serve works, build fails.
đ¨ Build failed.
@parcel/transformer-sass: Can't find stylesheet to import.
âˇ
1 â @import "tailwindcss/base";
â ^^^^^^^^^^^^^^^^^^
âĩ
src/index.global.scss 1:9 root stylesheet
@jpgilchrist That seems to work for me (both serve and build). Can you open a new issue with a complete code sample to reproduce this?
Just switching it to "node_modules/tailwind" did the trick per the recommendation above. Ill try to reproduce in a clean environment.
Seeing the same issue here.
My project structure is like so:
.
âââ package-lock.json
âââ package.json
âââ src
âââ index.html
âââ script.js
âââ style.scss
It works fine when serve
ing, but fails when build
ing. I was able to workaround the issue by adding a .sassrc
file to the project root:
{
"includePaths": [
"node_modules"
]
}
EDIT: I just set out to recreate a minimal reproduction, but i didn't get the issue. So I assume it was some caching thing. If i now go back to my actual project, delete the parcel cache, and build again, it all works (even without the sassrc file)
I have a similar issue. I was using the npm:
syntax inside my SASS files like this:
@import "npm:@picocss/pico/scss/variables";
This worked with parcel src/index.pug
, but not with parcel build src/index.pug
. It did work, however, once I removed the main-property from my package.json which was set to index.js
:
{
"name": "my-package",
"main": "index.js"
}
Parcel thought I was trying to build a library, but I was actually building a simple web page. I'm not sure what the connection is to my import statement, though.
I don't know if it's Parcel or Sass's fault, but I too struggled with this. I trialed-and-errored till something finally worked. I ended up with:
@use "node_modules/@picocss/pico/scss/pico"
but I tried so many variations. I'm sorry, but I'm not a SASS expert. I wish the error message could have included the name of the file(s) it tried to read from disk that ultimately raise an ENOENT error from the fs
module.
@use "node_modules/@picocss/pico/scss/pico"
looks strange but it works
Same issue here
The problem for me is that includeNodeModules
was false
when run as parcel build
but not parcel serve
. Adding this to package.json
fixed it:
"targets": {
"main": {
"includeNodeModules": {
"*.scss": true
}
}
}
parcel src/index.html
andparcel serve src/index.html
work fine with my App.scss file:But then when I try to build for production using
parcel build src/index.html
i get this error:Here is my
index.html
Originally posted by @Ethan-Arrowood in https://github.com/parcel-bundler/parcel/issues/3377#issuecomment-627095775