Skip to content

Commit a3faf09

Browse files
committed
support webpack 4
1 parent aee1489 commit a3faf09

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

lib/loader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ function hasRecyclable (template) {
5252

5353
module.exports = function (content) {
5454
this.cacheable()
55-
// var isServer = this.options.target === 'node'
55+
// var isServer = (this.options || this._compiler.options).target === 'node'
5656
// var isServer = false
5757
var loaderContext = this
5858
var query = loaderUtils.getOptions(this) || {}
5959
var params = this.resourceQuery && loaderUtils.parseQuery(this.resourceQuery)
60-
var options = this.options.__vueOptions__ = Object.assign({}, this.options.vue, this.vue, query)
60+
var options = (this.options || this._compiler.options).__vueOptions__ = Object.assign({}, (this.options || this._compiler.options).vue, this.vue, query)
6161
var filePath = this.resourcePath
6262
var fileName = path.basename(filePath)
6363
var moduleId = 'data-v-' + genId(path.relative(process.cwd(), filePath))

lib/style-rewriter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module.exports = function (css, map) {
4242
var cb = this.async()
4343

4444
var query = loaderUtils.getOptions(this) || {}
45-
var options = this.options.__vueOptions__
45+
var options = (this.options || this._compiler.options).__vueOptions__
4646
var postcssOptions = options.postcss
4747

4848
// postcss plugins

lib/template-compiler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ module.exports = function (html) {
5555
this.cacheable()
5656
var isProduction = this.minimize || process.env.NODE_ENV === 'production'
5757
var query = loaderUtils.getOptions(this) || {}
58-
// var isServer = this.options.target === 'node'
58+
// var isServer = (this.options || this._compiler.options).target === 'node'
5959
// var isServer = false
60-
var vueOptions = this.options.__vueOptions__
60+
var vueOptions = (this.options || this._compiler.options).__vueOptions__
6161
// if (vueOptions.transformToRequire) {
6262
// transformToRequire = Object.assign(
6363
// {},

lib/template-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = function (content) {
66
this.cacheable && this.cacheable()
77
var callback = this.async()
88
var opt = loaderUtils.getOptions(this) || {}
9-
var vue = this.options.__vueOptions__
9+
var vue = (this.options || this._compiler.options).__vueOptions__
1010
if (vue && vue.template) {
1111
for (var key in vue.template) {
1212
opt[key] = vue.template[key]

0 commit comments

Comments
 (0)