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

[5.4] Can't compile Bootstrap 5.1.1 in production #3188

Closed
tagliala opened this issue Oct 4, 2021 · 6 comments
Closed

[5.4] Can't compile Bootstrap 5.1.1 in production #3188

tagliala opened this issue Oct 4, 2021 · 6 comments

Comments

@tagliala
Copy link
Contributor

tagliala commented Oct 4, 2021

Hi,

this is not an issue with Webpacker, but I would like to report this here for searching purposes, hopefully save time to others for a subtle issue you may not notice in development and tests, and maybe there is someone willing to fix an issue in a direct Webpacker dependency.

The issue has been fixed in Bootstrap 5.1.2

How to reproduce:

$ rails _6.1.4.1_ new syntax-error-webpacker --skip-active-record --skip-javascript
$ cd syntax-error-webpacker/
$ echo "{ \"private\": true }" > package.json
$ echo "gem 'webpacker', '5.4.3'" >> Gemfile
$ bundle
$ bundle exec rails webpacker:install
$ yarn add bootstrap @popperjs/core@^2.10.1
$ echo "@import \"~bootstrap/scss/bootstrap\";" > app/javascript/packs/application.scss
$ NODE_ENV=production bin/webpack # does not happen in development

Error:

ERROR in ./app/javascript/packs/application.scss (./node_modules/css-loader/dist/cjs.js??ref--6-1!./node_modules/postcss-loader/src??ref--6-2!./node_modules/sass-loader/dist/cjs.js??ref--6-3!./app/javascript/packs/application.scss)
Module build failed (from ./node_modules/postcss-loader/src/index.js):
ParserError: Syntax Error at line: 1, column 25
    at ~/tests/syntax-error-webpacker/app/javascript/packs/application.scss:6:8164
    at Parser.error (~/tests/syntax-error-webpacker/node_modules/postcss-values-parser/lib/parser.js:127:11)
    at Parser.operator (~/tests/syntax-error-webpacker/node_modules/postcss-values-parser/lib/parser.js:162:20)
    at Parser.parseTokens (~/tests/syntax-error-webpacker/node_modules/postcss-values-parser/lib/parser.js:245:14)
    at Parser.loop (~/tests/syntax-error-webpacker/node_modules/postcss-values-parser/lib/parser.js:132:12)
    at Parser.parse (~/tests/syntax-error-webpacker/node_modules/postcss-values-parser/lib/parser.js:51:17)
    at parse (~/tests/syntax-error-webpacker/node_modules/postcss-custom-properties/index.cjs.js:47:30)
    at ~/tests/syntax-error-webpacker/node_modules/postcss-custom-properties/index.cjs.js:333:24
    at ~/tests/syntax-error-webpacker/node_modules/postcss/lib/container.js:194:18
    at ~/tests/syntax-error-webpacker/node_modules/postcss/lib/container.js:139:18
    at Rule.each (~/tests/syntax-error-webpacker/node_modules/postcss/lib/container.js:105:16)
    at Rule.walk (~/tests/syntax-error-webpacker/node_modules/postcss/lib/container.js:135:17)
    at ~/tests/syntax-error-webpacker/node_modules/postcss/lib/container.js:152:24
    at Root.each (~/tests/syntax-error-webpacker/node_modules/postcss/lib/container.js:105:16)
    at Root.walk (~/tests/syntax-error-webpacker/node_modules/postcss/lib/container.js:135:17)
    at Root.walkDecls (~/tests/syntax-error-webpacker/node_modules/postcss/lib/container.js:192:19)
    at transformProperties (~/tests/syntax-error-webpacker/node_modules/postcss-custom-properties/index.cjs.js:330:8)
    at Object.syncTransform [as plugin] (~/tests/syntax-error-webpacker/node_modules/postcss-custom-properties/index.cjs.js:522:5)
    at ~/tests/syntax-error-webpacker/node_modules/postcss-preset-env/index.js:443:97
 @ ./app/javascript/packs/application.scss 2:26-228
 @ multi ./app/javascript/packs/application.js ./app/javascript/packs/application.scss

Note that this may also be an issue with Webpacker 6 if you are going to recreate the same stack as Webpacker 5

Ref:

@tagliala tagliala closed this as completed Oct 4, 2021
@chuckbenger
Copy link

Thanks for posting this! I had same error and upgraded to new bootstrap version to fix.

@Kawsay
Copy link

Kawsay commented Feb 4, 2022

Really appreciate your initiative, had the exact same issue and your solution solved it perfectly. Thanks a lot !

@zavan
Copy link

zavan commented Sep 1, 2022

If anyone falls here and is using Bootstrap 5.2.0, looks like the error is back, my solution was to downgrade to Bootstrap 5.1.3 for now.

See this and this.

@pipe2k27
Copy link

pipe2k27 commented Sep 2, 2022

Same issue as zavan

@tagliala
Copy link
Contributor Author

tagliala commented Sep 4, 2022

5.2.1 should fix this twbs/bootstrap#37079

@zavan
Copy link

zavan commented Sep 7, 2022

5.2.1 is now released!

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

No branches or pull requests

5 participants