twbs / bootstrap

The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.
https://getbootstrap.com
MIT License
170.5k stars 78.84k forks source link

JisonLexerError: Lexical error on line 1: Unrecognized text. #35405

Closed Marcel-Hartmann closed 2 years ago

Marcel-Hartmann commented 2 years ago

Prerequisites

Describe the issue

I use the bootstrap-5.1.3 Version in my Laravel, VueJS Project for a while. Now only if I do npm run prod, I got this error:

ERROR in ./resources/sass/app.scss Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js): JisonLexerError: Lexical error on line 1: Unrecognized text.

Erroneous area: 1: none - 1px ^..^ at /Users/snitch/Work/DDV/Auktio_2/auktio2/resources/sass/app.scss:3801:3

But dev build works fine. I have googled and found solutions but for bootstrap 4.3 an old version. Does anyone know where I can find a part of the scss where I can fix this? app.scss:3801:3, should I count all lines in my includes to get to that line?

Any suggestions are welcome, maybe I found a Bug in 5.1.3, I did not know.

Kind Regards, Marcel

Reduced test cases

I have no files to add.

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

macOS

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

Chrome

What version of Bootstrap are you using?

v5.1.3

mdo commented 2 years ago

Can't help without a reproducible test case that shows this is coming from Bootstrap. This seems like an issue in your implementation.

Marcel-Hartmann commented 2 years ago

OK what should I post here to find a solution for this? Ihave a Laravel APP and I use laravel-mix, bootstrap-5.1.3 and SCSS postcss setup.

Marcel

Marcel-Hartmann commented 2 years ago

I think I have found the bug. So, in the .modal-header class in the _modal.scss file, there is the following include:

.modal-header {
...
@include border-top-radius($modal-content-inner-border-radius);
...

This line uses the @mixin border-top-radius($radius: $border-radius) if $enable-rounded is true. The output of this line is:

.modal-header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  padding: 2.5rem 2.5rem;
  border-bottom: 1px solid #333333;
  border-top-left-radius: calc(none - 1px);
  border-top-right-radius: calc(none - 1px);
}

and the none will break my prod build. After looking at the scss files, there is the function valid-radius() but I did not know how to modify it to prevent this error in the future.

Any Ideas?

Marcel-Hartmann commented 2 years ago

or it is the default variable -> $modal-content-border-radius: none; ?? in _variables.scss? I set to 0px and now the error is gone.