Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esbuild can't import scss files from node_modules #831

Open
DEfusion opened this issue Dec 1, 2023 · 1 comment
Open

esbuild can't import scss files from node_modules #831

DEfusion opened this issue Dec 1, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@DEfusion
Copy link

DEfusion commented Dec 1, 2023

Bridgetown Version: bridgetown 1.3.1 "Kelly Butte"

To Reproduce

  1. bridgetown new foo --use-sass
  2. yarn add normalize-scss
  3. Add @import "normalize"; to frontend/styles/index.scss
  4. yarn esbuild

Current behavior
It does not compile, with the following error:

✘ [ERROR] Can't find stylesheet to import.
  ╷
1 │ @import "normalize";
  │         ^^^^^^^^^^^
  ╵
  frontend/styles/index.scss 1:9  root stylesheet [plugin sass]

    frontend/javascript/index.js:1:7:
      1 │ import "$styles/index.scss"
        ╵        ~~~~~~~~~~~~~~~~~~~~

  This error came from the "onLoad" callback registered here:

    config/esbuild.defaults.js:151:10:
      151 │     build.onLoad({ filter: /\.(sass|scss)$/ }, async (args) => {
          ╵           ~~~~~~

    at setup (foo/config/esbuild.defaults.js:151:11)
    at handlePlugins (foo/node_modules/esbuild/lib/main.js:1292:21)

I could get around it by changing the import to @import "../../node_modules/normalize-scss/sass/normalize"; however the actual package I'm having trouble with is a private package which itself also imports SCSS from other packages so that is not an option here.

Expected behavior

It should compile.

Computing environment (please complete the following information):

  • OS: MacOS
  • Browser: N/A
  • Ruby Version: 3.1.1
@DEfusion DEfusion added the bug Something isn't working label Dec 1, 2023
@jaredcwhite
Copy link
Member

Can you try @import "normalize-scss/sass/normalize";? It's unclear to me if there's any sort of standard Node package resolution that would actually support just @import "normalize";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants