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

Syntax Error: SassError in Quasar devServer with Yarn workspace #10172

Closed
2 of 14 tasks
anhzf opened this issue Jul 23, 2021 · 12 comments
Closed
2 of 14 tasks

Syntax Error: SassError in Quasar devServer with Yarn workspace #10172

anhzf opened this issue Jul 23, 2021 · 12 comments
Labels

Comments

@anhzf
Copy link

anhzf commented Jul 23, 2021

Describe the bug
So I've created a new yarn workspace as a step in reproduce but what I've got is COMPILATION ERROR

To Reproduce
Steps to reproduce the behavior:

  1. yarn init
  2. git init
  3. git submodule add -n web [quasarProjectRepositoryUrl] packages/web

this is a new quasar project with windicss configured via webpack, you can check out here https://github.com/iamlazy-dev/app-web

  1. add workspaces fields in package.json in root project with ["packages/*"] and set private fields to true
  2. yarn install
  3. add script yarn workspace [packageName] named "web"
  4. execute yarn web quasar dev to start the devServer

Expected behavior
COMPILATION ERROR is gone

Screenshots
image

Platform (please complete the following information):
Quasar Version: 2
@quasar/app Version: 3.0.0

Quasar mode:

  • SPA
  • SSR
  • PWA
  • Electron
  • Cordova
  • Capacitor
  • BEX

Tested on:

  • SPA
  • SSR
  • PWA
  • Electron
  • Cordova
  • Capacitor
  • BEX

OS:
Node: 14.17.0
NPM: 6.14.13
Yarn: 1.22.10
Browsers: -
iOS: -
Android: -
Electron: -

Additional context
monorepo with yarn workspaces, yarn without workspace its fine as well as npm

@anhzf anhzf added kind/bug 🐞 Qv2 🔝 Quasar v2 issues labels Jul 23, 2021
@hawkeye64
Copy link
Member

Have you done any research on this or just want members of the team to do that for you? If you need faster service, the you should investigate a bit and let us know what you have found.

While I don't specifically think this is a Quasar issue, searching for sass, sass-loader, webpack, yarn workspace, etc and some sort of correlation would have helped A LOT.

I found these:
webpack-contrib/sass-loader#820
webpack-contrib/sass-loader#804 (comment)
https://gitmemory.com/issue/yarnpkg/yarn/4867/520995582

The best I could figure is when in a yarn workspace (which I use all the time without issue) that uses a git sub-module, you have to yarn install --force in order to build the sass node bindings properly for it to work.

@anhzf
Copy link
Author

anhzf commented Jul 24, 2021

Have you done any research on this or just want members of the team to do that for you? If you need faster service, the you should investigate a bit and let us know what you have found.

In advance, I apologize and thank you so much to the quasar community especially to @hawkeye64.
I'll try my best after this 😅, it's sound new to me
I just try yarn install --force but nothing different

@hawkeye64
Copy link
Member

@anhzf
This is what I am seeing in dist/quasar.sass

.q-loading-bar
  position: fixed
  z-index: $z-max
  transition: transform .5s cubic-bezier(0,0,.2,1), opacity .5s
  background: $red
  &--top
    left: 0 #{"/* rtl:ignore */"}
    right: 0 #{"/* rtl:ignore */"}
    top: 0
    width: 100%
  &--bottom
    left: 0 #{"/* rtl:ignore */"}
    right: 0 #{"/* rtl:ignore */"}
    bottom: 0
    width: 100%
  &--right
    top: 0
    bottom: 0
    right: 0
    height: 100%
  &--left
    top: 0
    bottom: 0
    left: 0
    height: 100%

This left: 0 #{"/* rtl:ignore */"} is a special syntax that allows this line to be ignored when also compiled for RTL.
However, in your quasar.sass, it appears as if you have a space separating the # and {.
Can you confirm this or is that just how the output was created?

@anhzf
Copy link
Author

anhzf commented Jul 25, 2021

@anhzf
This is what I am seeing in dist/quasar.sass

.q-loading-bar
  position: fixed
  z-index: $z-max
  transition: transform .5s cubic-bezier(0,0,.2,1), opacity .5s
  background: $red
  &--top
    left: 0 #{"/* rtl:ignore */"}
    right: 0 #{"/* rtl:ignore */"}
    top: 0
    width: 100%
  &--bottom
    left: 0 #{"/* rtl:ignore */"}
    right: 0 #{"/* rtl:ignore */"}
    bottom: 0
    width: 100%
  &--right
    top: 0
    bottom: 0
    right: 0
    height: 100%
  &--left
    top: 0
    bottom: 0
    left: 0
    height: 100%

This left: 0 #{"/* rtl:ignore */"} is a special syntax that allows this line to be ignored when also compiled for RTL.
However, in your quasar.sass, it appears as if you have a space separating the # and {.
Can you confirm this or is that just how the output was created?

because of this, I think it's internal from quasar so I posted it here. as you can see too in my screenshot above the output provide me to the wrong line (694:14) when I check it, it's totally different line so I can't figure out what happens

below is the screenshot of when I open that line
image

one more, why it's not working in yarn workspaces

@hawkeye64
Copy link
Member

one more, why it's not working in yarn workspaces

This I don't know. I have about a dozen projects on the go that use yarn workspaces and don't have this issue.

Does it work if you remove the yarn workspace info, delete all your node_modules folders and delete yarn.lock, and treat them as individual projects?

Let's see if we can narrow this down.

@anhzf
Copy link
Author

anhzf commented Jul 25, 2021

Does it work if you remove the yarn workspace info, delete all your node_modules folders and delete yarn.lock, and treat them as individual projects?

of course, I've repeated that reproduce step above three times

@hawkeye64
Copy link
Member

@anhzf The only other thing I can see that I do differently is this: yarn web quasar dev
I do this

cd web
quasar dev

@anhzf
Copy link
Author

anhzf commented Jul 25, 2021

@anhzf The only other thing I can see that I do differently is this: yarn web quasar dev

yeah, this is because the yarn itself recommended to run everything via yarn,

cd web
quasar dev

I've to do this before, and it's not work

@anhzf
Copy link
Author

anhzf commented Jul 25, 2021

I've tried some experiments, I do exactly the same as in reproducing step but with a new quasar project repository and it's fine without any error.

the difference is, my old project is using WindiCSS webpack plugin as you can see in my quasar.config.js

sorry, I'm new in the community, should I migrate this issue to WindiCSS instead? 😅

@hawkeye64
Copy link
Member

@anhzf If you can't get it to replicate on a new Quasar project, but it does happen when you add windicss, then yes.

A bit more info/ammo...

It appears behind the scenes that windicss is also processing the sass/scss, but they are not using an RTL preprocessor (quasar uses postcss-rtlcss) and therefore, by the time it's passed to sass, the comments have not been stripped off and sass chokes.

@anhzf
Copy link
Author

anhzf commented Jul 26, 2021

thank you @hawkeye64 for following these issues, there's a postcss plugin to use WindiCSS and no error at least at I posted this comment

@soulsam480
Copy link
Contributor

soulsam480 commented Oct 24, 2021

Had the same issue, fixed by adding the windicss postcss plugin instead.

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

No branches or pull requests

3 participants