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

unnecessary modules imports which caused module loop #153

Closed
devdeepak-hub opened this issue May 16, 2020 · 1 comment
Closed

unnecessary modules imports which caused module loop #153

devdeepak-hub opened this issue May 16, 2020 · 1 comment

Comments

@devdeepak-hub
Copy link

I was trying to migrate bootstrap scss, then this error occur

SassError: Module loop: this module is already being loaded.

The cause of this error is that migrator is importing unnecessary modules which causing a module loop. For example :

This is a code of _variable.scss

// Variables
//
// Variables should follow the `$component-state-property-size` formula for
// consistent naming. Ex: $nav-link-disabled-color and $modal-content-box-shadow-xs.

// Color system

$white:    #fff !default;
$gray-100: #f8f9fa !default;
$gray-200: #e9ecef !default;
$gray-300: #dee2e6 !default;
$gray-400: #ced4da !default;
$gray-500: #adb5bd !default;
$gray-600: #6c757d !default;
$gray-700: #495057 !default;
$gray-800: #343a40 !default;
$gray-900: #212529 !default;
$black:    #000 !default;

$grays: () !default;
.....

Now when i migrated this code using migrator, resulting code is this

@use "sass:color";
@use "sass:list";
@use "sass:map";
@use "sass:string";
@use "functions";

// Variables
//
// Variables should follow the `$component-state-property-size` formula for
// consistent naming. Ex: $nav-link-disabled-color and $modal-content-box-shadow-xs.

// Color system

$white:    #fff !default;
$gray-100: #f8f9fa !default;
$gray-200: #e9ecef !default;
$gray-300: #dee2e6 !default;
$gray-400: #ced4da !default;
$gray-500: #adb5bd !default;
$gray-600: #6c757d !default;
$gray-700: #495057 !default;
$gray-800: #343a40 !default;
$gray-900: #212529 !default;
$black:    #000 !default;

$grays: () !default;

As you can see it is importing module function which is not required and function module is already importing variable which caused an module loop error.

@jathak
Copy link
Member

jathak commented May 18, 2020

Marking this as a duplicate of #137.

Looking at the full source, it looks like _variables.scss and _functions.scss actually do depend on each other (so @use "functions" is required in _variables.scss and vice-versa). The migrator can't handle circular dependencies, so it should error here, but some manual effort to break the cycle will be required to actually migrate Bootstrap.

@jathak jathak closed this as completed May 18, 2020
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

2 participants