SnowdogApps / magento2-frontools

Set of front-end tools for Magento 2 based on Gulp.js
MIT License
430 stars 142 forks source link

ReferenceError: plugins is not defined #430

Closed MaxAlekseyev closed 2 years ago

MaxAlekseyev commented 2 years ago

Hello,

Ubuntu 20.04 gulp -v CLI version: 2.3.0 Local version: 4.0.2 node v12.22.7 npm 6.14.15 Installed via composer + npm i

Got the stable error on node 12 and 14, node-sass and dart-sass: ReferenceError: plugins is not defined

Any ideas?

Igloczek commented 2 years ago

Did you set some PostCSS plugins in your themes.json?

MaxAlekseyev commented 2 years ago

My config

{
  "blank": {
    "src": "vendor/snowdog/theme-blank-sass",
    "dest": "pub/static/frontend/Snowdog/blank",
    "locale": ["en_US"],
    "ignore": [".test"]
  },
  "laf-v1": {
    "src": "app/design/frontend/Laf/v1",
    "dest": "pub/static/frontend/Laf/v1",
    "locale": ["en_US"],
    "parent": "blank",
    "postcss": ["plugins.autoprefixer()"],
    "disableSuffix": true,
    "localeOverwrites": true
  }
}
Igloczek commented 2 years ago

Oh, you have a kinda old config, that's causing issues.

You can remove the "postcss": ["plugins.autoprefixer()"], completely, Autoprefxer is applied by default. Since v1.5.0 Frontools are not supporting localeOverwrites, so if you are using it (but looks like you are not, since you are using just a single language). If not, just remove it too.

MaxAlekseyev commented 2 years ago

Clenuped config, rm -rf node_modules/ ; npm i

{
  "blank": {
    "src": "vendor/snowdog/theme-blank-sass",
    "dest": "pub/static/frontend/Snowdog/blank",
    "locale": ["en_US"],
    "ignore": [".test"]
  },
  "laf-v1": {
    "src": "app/design/frontend/Laf/v1",
    "dest": "pub/static/frontend/Laf/v1",
    "locale": ["en_US"],
    "parent": "blank",
    "disableSuffix": true,
  }
}

gulp styles -> ReferenceError: plugins is not defined

Igloczek commented 2 years ago

Are you sure you edited the correct file and saved it? There is no reason for it to behave like this after changes.

It's also not related with dependecies, so you don't have to remove them etc.

MaxAlekseyev commented 2 years ago

Checked once more to be sure, edited and saved file that I posted locates in /vendor/snowdog/frontools/config

Igloczek commented 2 years ago

Do you have maybe a dev/tools/frontools/config/themes.json file also? If so, it has higher priority.

MaxAlekseyev commented 2 years ago

Yes you are right, I forgot about this, I removed this folder to have one file copy to debug. The new error I got: SyntaxError: Unexpected token } in JSON at position 338

http://c2n.me/4dEfVJV

Igloczek commented 2 years ago

I believe you can debug a non-valid JSON on your own 😄

Hint - there is a comma that shouldn't be there.

MaxAlekseyev commented 2 years ago

OMG, sure, I a little bit crazy because of the setup, so was careless. That's really just the comma for now :) Thank you very much, have a good evening! You are my hero for today!!! :)

Success: http://c2n.me/4dEgkvG