File tree Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Expand file tree Collapse file tree 2 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -153,10 +153,15 @@ module.exports = function (content) {
153
153
} )
154
154
155
155
// add require for script
156
+ var script
156
157
if ( parts . script . length ) {
158
+ script = parts . script [ 0 ]
157
159
output +=
158
- 'module.exports = ' + getRequire ( 'script' , parts . script [ 0 ] , 0 ) + '\n' +
159
- 'if (module.exports.__esModule) module.exports = module.exports.default\n'
160
+ 'module.exports = ' + (
161
+ script . src
162
+ ? getRequireForImport ( 'script' , script , 0 )
163
+ : getRequire ( 'script' , script , 0 )
164
+ ) + '\nif (module.exports.__esModule) module.exports = module.exports.default\n'
160
165
}
161
166
162
167
// add require for template
Original file line number Diff line number Diff line change @@ -32,11 +32,6 @@ module.exports = function (content) {
32
32
33
33
// handle src imports
34
34
if ( src ) {
35
- if ( type !== 'style' && type !== 'template' ) {
36
- return cb ( new Error (
37
- '[vue-loader] src import is only supported for <template> and <style> tags.'
38
- ) )
39
- }
40
35
if ( type === 'style' ) {
41
36
output . styleImports . push ( {
42
37
src : src ,
@@ -48,6 +43,11 @@ module.exports = function (content) {
48
43
src : src ,
49
44
lang : lang
50
45
} )
46
+ } else if ( type === 'script' ) {
47
+ output . script . push ( {
48
+ src : src ,
49
+ lang : lang
50
+ } )
51
51
}
52
52
return
53
53
}
You can’t perform that action at this time.
0 commit comments