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) {
153153 } )
154154
155155 // add require for script
156+ var script
156157 if ( parts . script . length ) {
158+ script = parts . script [ 0 ]
157159 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'
160165 }
161166
162167 // add require for template
Original file line number Diff line number Diff line change @@ -32,11 +32,6 @@ module.exports = function (content) {
3232
3333 // handle src imports
3434 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- }
4035 if ( type === 'style' ) {
4136 output . styleImports . push ( {
4237 src : src ,
@@ -48,6 +43,11 @@ module.exports = function (content) {
4843 src : src ,
4944 lang : lang
5045 } )
46+ } else if ( type === 'script' ) {
47+ output . script . push ( {
48+ src : src ,
49+ lang : lang
50+ } )
5151 }
5252 return
5353 }
You can’t perform that action at this time.
0 commit comments