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

dart-sass error since bootstrap 5.3.3 #39978

Open
3 tasks done
arnriu opened this issue May 13, 2024 · 4 comments
Open
3 tasks done

dart-sass error since bootstrap 5.3.3 #39978

arnriu opened this issue May 13, 2024 · 4 comments

Comments

@arnriu
Copy link

arnriu commented May 13, 2024

Prerequisites

Describe the issue

Since bootstrap 5.3.3, dart-sass 1.77.1 is not compiling.
If I go back to bootstrap 5.3.2, everything is fine. If I switch to original sass 1.77.1, everything is fine.

Error in console:

node:internal/url:804
    this.#updateContext(bindingUrl.parse(input, base));

TypeError: Invalid URL
    at new URL (node:internal/url:804:36)
    at removeLegacyImporterFromSpan (/project_path/node_modules/.pnpm/sass-embedded@1.74.1/node_modules/sass-embedded/dist/lib/src/legacy/utils.js:35:28)
    at newLegacyException (/project_path/node_modules/.pnpm/sass-embedded@1.74.1/node_modules/sass-embedded/dist/lib/src/legacy/index.js:253:72)
    at /project_path/node_modules/.pnpm/sass-embedded@1.74.1/node_modules/sass-embedded/dist/lib/src/legacy/index.js:24:116
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_INVALID_URL',
  input: '/project_path/node_modules/.pnpm/bootstrap@5.3.3_@popperjs+core@2.11.8/node_modules/bootstrap/scss/_variables.scss'
}

Reduced test cases

You can try this devbox with bootstrap 5.3.3. npm start fails
Now in package.json , change bootstrap to 5.3.2, then npm i && npm start. It works.

I only imported 2 files in index.sass, for minimum case. First is functions.scss which seems to be ok in both versions, second is variables.scss, which fails in 5.3.3.

https://codesandbox.io/p/devbox/competent-mahavira-4vgdjg?embed=1&file=%2Fpackage.json

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

No response

What version of Bootstrap are you using?

5.3.3

@arnriu
Copy link
Author

arnriu commented May 13, 2024

Problem seems to happen since this commit from @julien-deramond , and more specifically, from the last line in variables.scss.
If I comment it out, everything is fine.

@import "variables-dark"; // TODO: can be removed safely in v6, only here to avoid breaking changes in v5.3

@mdo
Copy link
Member

mdo commented Jun 13, 2024

Is this still an issue? I haven't run into anything locally myself.

@arnriu
Copy link
Author

arnriu commented Jun 13, 2024

@mdo Yes, this is still an issue. I can reproduce it on my localhost with everything up to date.
You can try it in the code sandbox I mentioned in my first post:
https://codesandbox.io/p/devbox/competent-mahavira-4vgdjg?embed=1&file=%2Fpackage.json

@julien-deramond
Copy link
Member

I can confirm that there's an issue when launching npm run build in your reproducible environment (thanks for providing one). I encountered the exact same error.

The following worked:

  1. Downloaded your project.
  2. In package.json, changed the Sass version from npm:sass-embedded@1.77.1 to 1.77.1.
  3. Ran npm i followed by npm run build.

I also tried changing the Node and Vite versions, but the error persisted.

The problem appears to be linked to npm:sass-embedded (even with npm:sass-embedded@latest).

Based on these elements only, I might be wrong but I'd say that our Sass files are correctly written and shouldn't need to be reverted. The issue might lie directly within npm:sass-embedded or possibly an incompatibility with the Vite configuration.

It might be useful to further isolate the issue by removing Vite from the equation and seeing if the problem persists.

If anyone from the community has time to try this, it would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants