Skip to content

Commit fc84b12

Browse files
committed
fix: similar component names loading
1 parent e72aa28 commit fc84b12

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ exports.createPart = function createPart(settings, options) {
7676
};
7777

7878
exports.createParts = function createParts(options, dirPath, inputFile, fileNames) {
79-
var inputFileName = new RegExp(`^${ inputFile.split(options.test)[0] }`);
79+
var inputFileName = new RegExp(`^${ inputFile.split(options.test)[0] }${ options.test.source || options.test }`);
8080
var parts = {},
8181
that = this;
8282

test/loader.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,4 +280,15 @@ describe('loader: success', function () {
280280

281281
assert.strictEqual(result, expected);
282282
});
283+
284+
it('should has two parts even when similar component names occurs - third component', function () {
285+
var content = require(similarComponentNamesDir + 'ComponentVerySimilar.vue');
286+
287+
var expected = '<template separated src="' + similarComponentNamesDir + 'ComponentVerySimilar.vue.html" lang="html"></template>' +
288+
'<script separated src="' + similarComponentNamesDir + 'ComponentVerySimilar.vue.js" lang="js"></script>';
289+
290+
var result = loader.apply(_.assign({}, webpack, { context: similarComponentNamesDir }), [content, { file: 'ComponentVerySimilar.vue.js' }]);
291+
292+
assert.strictEqual(result, expected);
293+
});
283294
});

0 commit comments

Comments
 (0)