borodean / postcss-assets

An asset manager for PostCSS
MIT License
537 stars 32 forks source link

Module build failed: TypeError: Cannot read property 'relative' of undefined #45

Closed F21 closed 8 years ago

F21 commented 8 years ago

I ran into this error after upgrading to 4.0.0 with my webpack build:

ERROR in ./~/css-loader!./~/postcss-loader!./~/normalize.css/normalize.css
Module build failed: TypeError: Cannot read property 'relative' of undefined
    at C:\Users\user\Desktop\postcss-assets-4.0.0-error\node_modules\postcss-assets\index.js:32:20
    at LazyResult.run (C:\Users\user\Desktop\postcss-assets-4.0.0-error\node_modules\postcss\lib\lazy-result.js:206:20)
    at C:\Users\user\Desktop\postcss-assets-4.0.0-error\node_modules\postcss\lib\lazy-result.js:120:37
    at LazyResult.asyncTick (C:\Users\user\Desktop\postcss-assets-4.0.0-error\node_modules\postcss\lib\lazy-result.js:134:15)
    at processing.Promise.then._this2.processed (C:\Users\user\Desktop\postcss-assets-4.0.0-error\node_modules\postcss\lib\lazy-result.js:160:20)
    at LazyResult.async (C:\Users\user\Desktop\postcss-assets-4.0.0-error\node_modules\postcss\lib\lazy-result.js:157:27)
    at LazyResult.then (C:\Users\user\Desktop\postcss-assets-4.0.0-error\node_modules\postcss\lib\lazy-result.js:79:21)
    at Object.module.exports (C:\Users\user\Desktop\postcss-assets-4.0.0-error\node_modules\postcss-loader\index.js:47:32)
 @ ./~/normalize.css/normalize.css 4:14-96

To reproduce, simply clone this repo: https://github.com/F21/postcss-assets-4.0.0-error

Then run npm install and npm run build.

ai commented 8 years ago

@F21 You can fix issue by sending empty { } options.

@borodean I had this issue too. Can you add check if ( !opts ) opts = { }?

borodean commented 8 years ago

@F21 thanks for reporting, checking it out now.

borodean commented 8 years ago

@F21 fixed in 4.0.1.

F21 commented 8 years ago

Thanks! :)