Skip to content

Commit 5679c54

Browse files
hzchirsNataliaTepluhina
authored andcommitted
Fix Style Guide: Base component names example (#2449)
Webpack `require.context` matches file relative path. For example: `['./BaseXXX.vue', './BaseYYY.vue']`, the path starts with './' regex `/^Base/` will get empty result.
1 parent 9790624 commit 5679c54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/v2/style-guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ Some advantages of this convention:
774774
- Since these components are so frequently used, you may want to simply make them global instead of importing them everywhere. A prefix makes this possible with Webpack:
775775

776776
``` js
777-
var requireComponent = require.context("./src", true, /^Base[A-Z]/)
777+
var requireComponent = require.context("./src", true, /Base[A-Z]\w+\.(vue|js)$/)
778778
requireComponent.keys().forEach(function (fileName) {
779779
var baseComponentConfig = requireComponent(fileName)
780780
baseComponentConfig = baseComponentConfig.default || baseComponentConfig

0 commit comments

Comments
 (0)