File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 1
1
module . exports = function normalizeComponent (
2
- scriptExports ,
2
+ rawScriptExports ,
3
3
compiledTemplate ,
4
4
scopeId ,
5
5
cssModules
6
6
) {
7
- scriptExports = scriptExports || { }
7
+ var esModule
8
+ var scriptExports = rawScriptExports = rawScriptExports || { }
8
9
9
10
// ES6 modules interop
10
- var type = typeof scriptExports . default
11
+ var type = typeof rawScriptExports . default
11
12
if ( type === 'object' || type === 'function' ) {
12
- // check named exports
13
- if ( process . env . NODE_ENV !== 'production' ) {
14
- if ( Object . keys ( scriptExports ) . some ( function ( key ) {
15
- return key !== 'default' && key !== '__esModule'
16
- } ) ) {
17
- console . error ( 'named exports are not supported in *.vue files.' )
18
- }
19
- }
20
- scriptExports = scriptExports . default
13
+ esModule = rawScriptExports
14
+ scriptExports = rawScriptExports . default
21
15
}
22
16
23
17
// Vue.extend constructor export interop
@@ -46,6 +40,7 @@ module.exports = function normalizeComponent (
46
40
}
47
41
48
42
return {
43
+ esModule : esModule ,
49
44
exports : scriptExports ,
50
45
options : options
51
46
}
Original file line number Diff line number Diff line change @@ -299,6 +299,13 @@ module.exports = function (content) {
299
299
if ( ! isProduction ) {
300
300
// add filename in dev
301
301
output += 'Component.options.__file = ' + JSON . stringify ( filePath ) + '\n'
302
+ // check named exports
303
+ output +=
304
+ 'if (Component.esModule && Object.keys(Component.esModule).some(function (key) {' +
305
+ 'return key !== "default" && key !== "__esModule"' +
306
+ '})) {' +
307
+ 'console.error("named exports are not supported in *.vue files.")' +
308
+ '}\n'
302
309
// check functional components used with templates
303
310
if ( template ) {
304
311
output +=
You can’t perform that action at this time.
0 commit comments