Skip to content

Commit faaeee4

Browse files
fix(index): postcss.config.js not resolved correctly (options.config)
1 parent 4f20c99 commit faaeee4

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/index.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,25 @@ module.exports = function loader (css, map) {
4848
validateOptions(require('./options.json'), options, 'PostCSS Loader')
4949

5050
const rc = {
51-
path: '',
51+
path: path.dirname(file),
5252
ctx: {
5353
file: {
5454
extname: path.extname(file),
5555
dirname: path.dirname(file),
5656
basename: path.basename(file)
57-
}
57+
},
58+
options: {}
5859
}
5960
}
6061

6162
if (options.config) {
62-
options.config.path
63-
? rc.path = path.resolve(options.config.path)
64-
: rc.path = path.dirname(file)
63+
if (options.config.path) {
64+
rc.path = path.resolve(options.config.path)
65+
}
6566

66-
options.config.ctx
67-
? rc.ctx.options = options.config.ctx
68-
: rc.ctx.options = {}
67+
if (options.config.ctx) {
68+
rc.ctx.options = options.config.ctx
69+
}
6970
}
7071

7172
const sourceMap = options.sourceMap

0 commit comments

Comments
 (0)