4

In my Symfony 4 project, I try to add bootstrap as an import after

yarn add bootstrap --dev

As I follow documentation, I tried to import bootstrap as follows:

@import "~bootstrap/scss/bootstrap";

When I run yarn encore dev, it says module not found.

Than I tried this:

@import "../../node_modules/bootstrap/scss/bootstrap.scss";

The output is:

Syntax Error: ModuleNotFoundError: Module not found: Error: Can't resolve './alert' in 'C:\Users\tolga\GIT\artifex\node_modules\bootstrap\scss'

What am I missing? alert.scss is there but it cannot find module. What should I try?

2 Answers 2

8

It seems I somehow solved the problem. First of all the import directory is this:

@import "../../node_modules/bootstrap";

I don't know why tilde didn't work. Adding sass-loader didn't help.

Sign up to request clarification or add additional context in comments.

Comments

3

Old subject but the solution is to change the extension of file app.css to app.scss.

1 Comment

This solution works for me, but by default webpack-encore does not have support for sass, it should be installed and enabled in webpack.config.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.