Skip to content

Commit 5eec6ae

Browse files
kazuponyyx990803
authored andcommitted
Revert default component name option (vuejs#598)
* revert default name option based on filename related: vuejs#495 if several unnamed components have the same filename, occured endless loop. Closes vuejs#596 * update docs
1 parent def3703 commit 5eec6ae

File tree

4 files changed

+0
-15
lines changed

4 files changed

+0
-15
lines changed

docs/en/start/spec.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ Beware that `src` imports follow the same path resolution rules to CommonJS `req
8383
<style src="todomvc-app-css/index.css">
8484
```
8585
86-
### Component Name
87-
88-
If you don't specified the component name with [name](https://vuejs.org/v2/api/#name) component option, by default, it's named based on your `*.vue` filename (no `.vue` extention).
89-
9086
### Syntax Highlighting
9187
9288
Currently there is syntax highlighting support for [Sublime Text](https://github.com/vuejs/vue-syntax-highlight), [Atom](https://atom.io/packages/language-vue), [Vim](https://github.com/posva/vim-vue), [Visual Studio Code](https://marketplace.visualstudio.com/items/liuji-jim.vue), [Brackets](https://github.com/pandao/brackets-vue), and [JetBrains products](https://plugins.jetbrains.com/plugin/8057) (WebStorm, PhpStorm, etc). Contributions for other editors/IDEs are highly appreciated! If you are not using any pre-processors in Vue components, you can also get by treating `*.vue` files as HTML in your editor.

lib/component-normalizer.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module.exports = function normalizeComponent (
2-
name,
32
scriptExports,
43
compiledTemplate,
54
scopeId,
@@ -26,11 +25,6 @@ module.exports = function normalizeComponent (
2625
? scriptExports.options
2726
: scriptExports
2827

29-
// default name option based on filename
30-
if (options.name == null) {
31-
options.name = name
32-
}
33-
3428
// render functions
3529
if (compiledTemplate) {
3630
options.render = compiledTemplate.render

lib/loader.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,13 @@ module.exports = function (content) {
243243

244244
// we require the component normalizer function, and call it like so:
245245
// normalizeComponent(
246-
// name,
247246
// scriptExports,
248247
// compiledTemplate,
249248
// scopeId,
250249
// cssModules
251250
// )
252251
output += 'var Component = require("' + componentNormalizerPath + '")(\n'
253252

254-
// name
255-
output += ' /* name */\n ' + JSON.stringify(path.parse(filePath).name) + ',\n'
256-
257253
// <script>
258254
output += ' /* script */\n '
259255
var script = parts.script

test/test.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ describe('vue-loader', function () {
107107
test({
108108
entry: './test/fixtures/basic.vue'
109109
}, function (window, module, rawModule) {
110-
expect(module.name).to.equal('basic')
111110
var vnode = mockRender(module, {
112111
msg: 'hi'
113112
})

0 commit comments

Comments
 (0)