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

Resolve absolute paths #51

Open
gautier-lefebvre opened this issue Jan 9, 2019 · 1 comment
Open

Resolve absolute paths #51

gautier-lefebvre opened this issue Jan 9, 2019 · 1 comment
Assignees

Comments

@gautier-lefebvre
Copy link

Hello,

I have been using your plugin with sass-loader and node-sass.

node-sass has an option which allows us to specify the root folder of absolute @import paths:

{
  test: /\.scss$/i,
  loader: 'sass-loader',
  options: {
    includePaths: [
      './src/',
    ],
  },
}

includePaths is an option of node-sass and sass-loader just passes it through when compiling.

The problem is, this plugin doesn't look for this path when resolving the current imported file to decide whether or not to include the antd theme variables in src/antdSassLoader.js at line 22. It simply uses the resolver of sass-loader, not node-sass. This means that importing my antd theme file using an absolute path (e.g. @import 'style/theme.scss';) does not expose the antd theme variables.

The workaround is simply to use a relative path when importing this specific file when the antd variables are needed, but this is tedious.

Do you think adding an option to allow custom root folder, or an option to specify a resolver function overriding sass-loader's importsToResolve() would be viable for this plugin?

My best guess would be to simply consider this behaviour non standard and never use absolute paths on @import.

@prncc prncc self-assigned this Jan 19, 2019
@jeremy-cho
Copy link

Any updates on this?

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

3 participants