Skip to content

Commit def3703

Browse files
committed
always use absolute path for lib files (close #525)
1 parent 49795c6 commit def3703

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

lib/loader.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,17 @@ var defaultLang = {
3636
module.exports = function (content) {
3737
this.cacheable()
3838
var isServer = this.options.target === 'node'
39+
var isProduction = this.minimize || process.env.NODE_ENV === 'production'
40+
3941
var loaderContext = this
4042
var query = loaderUtils.parseQuery(this.query)
4143
var options = this.options.__vueOptions__ = Object.assign({}, this.options.vue, this.vue, query)
44+
4245
var filePath = this.resourcePath
4346
var fileName = path.basename(filePath)
4447
var moduleId = 'data-v-' + genId(filePath)
4548
var styleRewriter = styleRewriterPath + '?id=' + moduleId
4649

47-
var isProduction = this.minimize || process.env.NODE_ENV === 'production'
48-
4950
var needCssSourceMap =
5051
!isProduction &&
5152
this.sourceMap &&

lib/normalize.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ var fs = require('fs')
33
var path = require('path')
44

55
exports.lib = function (file) {
6-
if (IS_TEST) {
7-
return path.resolve(__dirname, file)
8-
} else {
9-
return 'vue-loader/lib/' + file
10-
}
6+
return path.resolve(__dirname, file)
117
}
128

139
exports.dep = function (dep) {

test/test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
process.env.VUE_LOADER_TEST = true
22

33
var path = require('path')
4+
var jsdom = require('jsdom')
45
var webpack = require('webpack')
56
var MemoryFS = require('memory-fs')
6-
var jsdom = require('jsdom')
77
var expect = require('chai').expect
88
var genId = require('../lib/gen-id')
9-
var SourceMapConsumer = require('source-map').SourceMapConsumer
10-
var ExtractTextPlugin = require("extract-text-webpack-plugin")
119
var compiler = require('../lib/template-compiler')
1210
var normalizeNewline = require('normalize-newline')
11+
var ExtractTextPlugin = require("extract-text-webpack-plugin")
12+
var SourceMapConsumer = require('source-map').SourceMapConsumer
1313

1414
var loaderPath = 'expose-loader?vueModule!' + path.resolve(__dirname, '../index.js')
1515
var mfs = new MemoryFS()

0 commit comments

Comments
 (0)