Skip to content

Commit 1a9b048

Browse files
awaw00yyx990803
authored andcommitted
使用10.x的named exports判断方式 (vuejs#588)
解决在webpack中配置了babel的sage-x之后引起的Object.keys(__vue_script__).length === 2引起误报的问题
1 parent 4917d73 commit 1a9b048

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/loader.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,7 @@ module.exports = function (content) {
216216
// check and warn named exports
217217
if (!this.minimize) {
218218
output +=
219-
'if (__vue_script__ &&\n' +
220-
' __vue_script__.__esModule &&\n' +
221-
' Object.keys(__vue_script__).length > 1) {\n' +
219+
'if (Object.keys(__vue_script__).some(function (key) { return key !== "default" && key !== "__esModule" })) {\n' +
222220
' console.warn(' + JSON.stringify(
223221
'[vue-loader] ' + path.relative(process.cwd(), filePath) +
224222
': named exports in *.vue files are ignored.'

0 commit comments

Comments
 (0)