|
1 | 1 | const loaderUtils = require('loader-utils')
|
2 | 2 | const { RESOLVED_FLAGS_PATH, IF_FLAG } = require('./constants')
|
3 | 3 | const ifDirReg = new RegExp(`\\s${IF_FLAG}(?:\\s*(=)\\s*(?:"([^"]+)"+|'([^']+)'+|([^\\s"'=<>\`]+)))`)
|
4 |
| -const hotReloadRegs = [/module\.hot\.accept\(/, /module\.hot\.data/, /vue/] |
| 4 | +// const hotReloadRegs = [/module\.hot\.accept\(/, /module\.hot\.data/, /vue/] |
5 | 5 |
|
6 | 6 | module.exports = function vueFlagsTemplateLoader (source, map) {
|
7 |
| - let vue, type |
8 |
| - const { watch } = loaderUtils.getOptions(this) |
9 |
| - if (!watch) { |
10 |
| - return this.callback(null, source, map) |
11 |
| - } |
| 7 | + // let vue, type |
| 8 | + // const { watch } = loaderUtils.getOptions(this) |
| 9 | + // if (!watch) { |
| 10 | + // return this.callback(null, source, map) |
| 11 | + // } |
12 | 12 | if (this.resourceQuery) {
|
13 |
| - ({ vue, type } = loaderUtils.parseQuery(this.resourceQuery)) |
14 |
| - } |
15 |
| - if (vue && type === 'template' && ifDirReg.test(source)) { |
16 |
| - this.addDependency(RESOLVED_FLAGS_PATH) |
17 |
| - } |
18 |
| - if (!type && this.hot && hotReloadRegs.every(r => r.test(source))) { |
19 |
| - // create component hot reload record by removing `module.hot.data`, see `vue-hot-reload-api` |
20 |
| - source = 'module.hot && module.hot.data && module.hot.data.__vue_component_hot__ && (module.hot.data = undefined);\n' + source |
| 13 | + const { vue, type } = loaderUtils.parseQuery(this.resourceQuery) |
| 14 | + if (vue && type === 'template' && ifDirReg.test(source)) { |
| 15 | + this.addDependency(RESOLVED_FLAGS_PATH) |
| 16 | + } |
21 | 17 | }
|
| 18 | + // if (!type && this.hot && hotReloadRegs.every(r => r.test(source))) { |
| 19 | + // // create component hot reload record by removing `module.hot.data`, see `vue-hot-reload-api` |
| 20 | + // source = 'module.hot && module.hot.data && module.hot.data.__vue_component_hot__ && (module.hot.data = undefined);\n' + source |
| 21 | + // } |
22 | 22 | this.callback(null, source, map)
|
23 | 23 | }
|
0 commit comments