Skip to content

Commit

Permalink
fix: windows path (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck authored Feb 3, 2020
1 parent dff1b03 commit f07860d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'path'
import { createFilter } from 'rollup-pluginutils'
import Concat from 'concat-with-sourcemaps'
import Loaders from './loaders'
import normalizePath from './utils/normalize-path'

/**
* The options that could be `boolean` or `object`
Expand Down Expand Up @@ -114,11 +115,11 @@ export default (options = {}) => {
const getExtracted = () => {
const fileName =
typeof postcssLoaderOptions.extract === 'string' ?
path.relative(dir, postcssLoaderOptions.extract) :
normalizePath(path.relative(dir, postcssLoaderOptions.extract)) :
`${path.basename(file, path.extname(file))}.css`
const concat = new Concat(true, fileName, '\n')
const entries = Array.from(extracted.values())
const { modules } = bundle[path.relative(dir, file)]
const { modules } = bundle[normalizePath(path.relative(dir, file))]

if (modules) {
const fileList = Object.keys(modules)
Expand All @@ -127,7 +128,7 @@ export default (options = {}) => {
)
}
for (const res of entries) {
const relative = path.relative(dir, res.id)
const relative = normalizePath(path.relative(dir, res.id))
const map = res.map || null
if (map) {
map.file = fileName
Expand Down
5 changes: 3 additions & 2 deletions src/utils/humanlize-path.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path'
import normalizePath from './normalize-path'

const humanlizePath = filepath => path.relative(process.cwd(),
filepath)
const humanlizePath = filepath => normalizePath(path.relative(process.cwd(),
filepath))

export default humanlizePath

0 comments on commit f07860d

Please sign in to comment.