Skip to content

Commit 7917b9d

Browse files
committed
✨ Support sub components
1 parent 4237880 commit 7917b9d

File tree

3 files changed

+4
-4396
lines changed

3 files changed

+4
-4396
lines changed

lib/getLocalIdent.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ module.exports = function getLocalIdent(loaderContext, localIdentName, localName
99
if(!options.context)
1010
options.context = loaderContext.options && typeof loaderContext.options.context === "string" ? loaderContext.options.context : loaderContext.context;
1111
var resourcePath = loaderContext.resourcePath;
12-
var request = path.relative(options.context, resourcePath);
12+
var request = path.relative(options.context, resourcePath.replace(/\.vue[\\/].*$/, ''));
1313
options.content = options.hashPrefix + request;
1414

1515
if (!localIdentName.includes('[local]'))
1616
options.content += '+' + localName;
1717

1818
// @TODO: This is a temp solution because a function cannot be transfered through a loader string.
1919
if (/\.vue[\\/]module\.css$/.test(resourcePath)) {
20-
var vueName = path.basename(path.dirname(resourcePath), '.vue');
20+
const tmpPath = resourcePath.replace(/\.vue[\\/]/g, '_').replace(/_module\.css$/, '');
21+
var vueName = path.basename(tmpPath);
2122
localIdentName = localIdentName.replace(/\[name\]/gi, vueName);
2223
}
2324

0 commit comments

Comments
 (0)