Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #4903
Something went wrong while setting issue due date.
Closed
Open
Issue created 6 years ago by Administrator@rootContributor
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

@next make sass loader include node_modules

Closed

@next make sass loader include node_modules

Created by: hyperknot

With the next branch, I'm using the built-in sass loader, works perfectly. However

  1. How can I configure it to include node_modules in the include path?
  2. Why is this not the default configuration? It's the most typical use case, CSS/SCSS libs are always distributed via npm these days.
An error occurred while loading designs. Please try again.
Tasks
0
server returned results with length 5, expected length of 9

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: hyperknot

    Putting ~ in front of module names makes it resolve to node_modules.

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: gaearon

    @Timer wanna get this into 2?

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: Timer

    I need to understand the proposed PR more, sass-loader makes it very clear you shouldn't use includePaths like #5011.

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: Timer

    Can you show us a specific case that doesn't work for you, but you'd like to?

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: Timer

    Oh, I think this is a request for absolute imports.

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: hyperknot

    Yes, exactly absolute imports. To make sure that we can bundle code from CSS frameworks, like:

    @import "semantic-ui-css/semantic.css";
    @import "perfect-scrollbar/css/perfect-scrollbar";
    @import "primer-forms/index";

    Exactly how you can via the command line node-sass CLI.

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: hyperknot

    Also, you should read https://github.com/sass/node-sass/issues/2362. It is the most widely commented and community opposed change in the history of SASS.

    Originally node-sass wanted to remove CSS import, but it's so important and so widely used in projects, that they finally changed their mind and it'll stay in 5.0.

    So 4.8 had it 4.10 will have it and 5.x will have it, but early versions of 4.9 displayed a warning about it.

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: Timer

    Hmm, given that ~ is already supported, why isn't that a good option?

    @import "~semantic-ui-css/semantic.css";
    @import "~perfect-scrollbar/css/perfect-scrollbar";
    @import "~primer-forms/index";

    ~ is explicit: resolve this like a module. This is how all of our existing .css files behave, too. It isn't preventing you from importing css.

    AFAIK a CSS import like file/b.css actually resolves like ./file/b.css (and this is how browsers work), so I think this behavior would be confusing if on by default.

    This is the same reason we never added src as a resolve alias to webpack, but are now considering adding it under @ or something -- just not naked.

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: Timer

    Yeah, this would be very bad. See bootstrap for example. What happens when one of those names are installed as a package? :boom:

  • Administrator
    Administrator @root · 6 years ago
    Author Contributor

    Created by: hyperknot

    I believe ~ is a perfect solution, I have no problem with that. I just wanted to make sure that:

    • ~ stays supported in the final version
    • it's documented somewhere, at least in this issue
Please register or sign in to reply
0 Assignees
None
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
0
0 participants
Reference:

Menu

Explore Projects Groups Snippets