Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix Style Guide: Base component names example
Webpack `require.context` matches file relative path.
For example: `['./BaseXXX.vue', './BaseYYY.vue']`, the path starts with './'
regex `/^Base/` will get empty result.
  • Loading branch information
hzchirs authored Jan 20, 2020
commit 300dde7bc6602c885bf5572bfb71c5752c60803d
2 changes: 1 addition & 1 deletion src/v2/style-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ Some advantages of this convention:
- 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:

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