File tree 3 files changed +11
-8
lines changed
3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const VueLoaderPlugin = require('../dist/plugin')
4
4
module . exports = {
5
5
mode : 'development' ,
6
6
entry : path . resolve ( __dirname , './main.js' ) ,
7
+ devtool : 'cheap-module-eval-source-map' ,
7
8
output : {
8
9
path : path . resolve ( __dirname , 'dist' ) ,
9
10
filename : 'bundle.js' ,
Original file line number Diff line number Diff line change 1
1
// __VUE_HMR_RUNTIME__ is injected to global scope by @vue /runtime-core
2
2
3
- export function genHotReloadCode ( id : string , templateRequest ?: string ) : string {
3
+ export function genHotReloadCode (
4
+ id : string ,
5
+ templateRequest : string | undefined
6
+ ) : string {
4
7
return `
5
8
/* hot reload */
6
9
if (module.hot) {
7
10
const api = __VUE_HMR_RUNTIME__
8
11
module.hot.accept()
9
- if (!api.isRecorded('${ id } ')) {
10
- api.createRecord('${ id } ', script)
11
- } else {
12
+ if (!api.createRecord('${ id } ', script)) {
12
13
api.reload('${ id } ', script)
13
14
}
14
15
${ templateRequest ? genTemplateHotReloadCode ( id , templateRequest ) : '' }
Original file line number Diff line number Diff line change @@ -115,8 +115,8 @@ const loader: webpack.loader.Loader = function(source) {
115
115
const scopedQuery = hasScoped ? `&scoped=true` : ``
116
116
const attrsQuery = attrsToQuery ( descriptor . template . attrs )
117
117
const query = `?vue&type=template${ idQuery } ${ scopedQuery } ${ attrsQuery } ${ inheritQuery } `
118
- const request = ( templateRequest = stringifyRequest ( src + query ) )
119
- templateImport = `import render from ${ request } `
118
+ templateRequest = stringifyRequest ( src + query )
119
+ templateImport = `import render from ${ templateRequest } `
120
120
}
121
121
122
122
// script
@@ -125,9 +125,10 @@ const loader: webpack.loader.Loader = function(source) {
125
125
const src = descriptor . script . src || resourcePath
126
126
const attrsQuery = attrsToQuery ( descriptor . script . attrs , 'js' )
127
127
const query = `?vue&type=script${ attrsQuery } ${ inheritQuery } `
128
- const request = stringifyRequest ( src + query )
128
+ const scriptRequest = stringifyRequest ( src + query )
129
129
scriptImport =
130
- `import script from ${ request } \n` + `export * from ${ request } ` // support named exports
130
+ `import script from ${ scriptRequest } \n` +
131
+ `export * from ${ scriptRequest } ` // support named exports
131
132
}
132
133
133
134
// styles
You can’t perform that action at this time.
0 commit comments