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

fix: avoid the "from" argument must be of type string error #908

Merged
merged 1 commit into from Mar 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/utils.js
Expand Up @@ -6,6 +6,7 @@ import path from 'path';

import cc from 'camelcase';
import loaderUtils from 'loader-utils';
import normalizePath from 'normalize-path';

/* eslint-disable line-comment-position */

Expand Down Expand Up @@ -71,9 +72,9 @@ function getLocalIdent(loaderContext, localIdentName, localName, options) {
options.context = loaderContext.rootContext;
}

const request = path
.relative(options.context, loaderContext.resourcePath)
.replace(/\\/g, '/');
const request = normalizePath(
path.relative(options.context || '', loaderContext.resourcePath)
);

// eslint-disable-next-line no-param-reassign
options.content = `${options.hashPrefix + request}+${unescape(localName)}`;
Expand Down