fix: source maps path on windows#532
Conversation
Codecov Report
@@ Coverage Diff @@
## master #532 +/- ##
==========================================
+ Coverage 98.36% 98.65% +0.29%
==========================================
Files 10 10
Lines 366 371 +5
Branches 87 89 +2
==========================================
+ Hits 360 366 +6
+ Misses 6 5 -1
Continue to review full report at Codecov.
|
michael-ciniawsky
left a comment
There was a problem hiding this comment.
Still node >= v0.12 in theory
lib/loader.js
Outdated
| } | ||
|
|
||
| if (map.sources) { | ||
| map.sources = map.sources.map((source) => source.replace(/\\/g, '/')); |
There was a problem hiding this comment.
.map((source) => ...) => .map(function(source) { return ... })
There was a problem hiding this comment.
@michael-ciniawsky oh yep, i don't support old node.js in my project 😄
There was a problem hiding this comment.
Neither do I 😛 and I'm really in favour make the switch as quickly as possible (node < 4.0.0 is dead), but if we 'break' things all kind of conservatives will come out of their rat holes and complain like crazy about it :D 'breaks app IN PRODUCTION' 'USE SEMVER!!!` etc...
windows.windows
|
https://github.com/postcss/postcss/blob/master/lib/map-generator.es6#L188-L189 But it seems to work on the relative file path (L187) only atm and maybe unrelated 😛 |
1863a86 to
86332ba
Compare
86332ba to
3608136
Compare
73d9876 to
92fc8d9
Compare
| mode: moduleMode ? "local" : "global", | ||
| from: loaderUtils.getRemainingRequest(this), | ||
| to: loaderUtils.getCurrentRequest(this), | ||
| from: loaderUtils.getRemainingRequest(this).split("!").pop(), |
There was a problem hiding this comment.
What is the output of loaderUtils.getRemainingRequest(this).split("!").pop()? If I remember right it should be the absolute file path and therefore we could replaced it with this.resourcePath instead?
There was a problem hiding this comment.
@michael-ciniawsky we can have remainingRequest https://github.com/webpack/loader-utils/blob/master/lib/getRemainingRequest.js#L4
There was a problem hiding this comment.
Best get file from getRemainingRequest it is more safe
There was a problem hiding this comment.
kk also not really related to this PR, just pop into my eyes
There was a problem hiding this comment.
Look into resourcePath, yup. I can't remember the exact API, though. Maybe this needs some guidelines.
There was a problem hiding this comment.
@bebraw why? what is bad in use loaderUtils.getRemainingRequest(this).split("!").pop(), also #532 (comment)
There was a problem hiding this comment.
@evilebottnawi I'm not entirely sure. At least test-wise the current implementation passes. It's fine to refactor later. 👍
| from: loaderUtils.getRemainingRequest(this), | ||
| to: loaderUtils.getCurrentRequest(this), | ||
| from: loaderUtils.getRemainingRequest(this).split("!").pop(), | ||
| to: loaderUtils.getCurrentRequest(this).split("!").pop(), |
There was a problem hiding this comment.
Should be equal to this.resourcePath aswell
|
@michael-ciniawsky if we enable |
|
|
||
| if (map.sources) { | ||
| map.sources = map.sources.map(function (source) { | ||
| return source.replace(/\\/g, '/'); |
There was a problem hiding this comment.
Test with path.sep? But I think it's unnecessary...
There was a problem hiding this comment.
@michael-ciniawsky yep, we should already changed \ to /
There was a problem hiding this comment.
@michael-ciniawsky This is a source map check. Can we assume forward slash there due to browser environment?
|
Yep appveyor would be a good idea, want is need to enable it besides |
|
@evilebottnawi @d3viant0ne @bebraw I think we should merge this meanwhile, despite the fact that current implementation will hopefully vanish soon 😛 , it's definitely a bug in the current |
|
@evilebottnawi Open an issue in defaults for appveyor and we can get started on a org wide config as a part of defaults. |
|
As far as this particular PR goes, there are a few open review comments. Patches are fine for the current major version so @bebraw @evilebottnawi @michael-ciniawsky if everyone is satisfied with this, throw a thumbs up on the comment and we'll get this landed. |
|
AppVeyor Tracking Issue #54 |
This Pull Request updates dependency [css-loader](https://github.com/webpack-contrib/css-loader) from `^0.28.11` to `^1.0.0` <details> <summary>Release Notes</summary> ### [`v1.0.0`](https://github.com/webpack-contrib/css-loader/blob/master/CHANGELOG.md#​100httpsgithubcomwebpack-contribcss-loadercomparev02811v100-2018-07-06) [Compare Source](webpack/css-loader@v0.28.11...v1.0.0) ##### BREAKING CHANGES * remove `minimize` option, use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`cssnano`](https://github.com/cssnano/cssnano) or use [`optimize-cssnano-plugin`](https://github.com/intervolga/optimize-cssnano-plugin) plugin * remove `module` option, use `modules` option instead * remove `camelcase` option, use `camelCase` option instead * remove `root` option, use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`postcss-url`](https://github.com/postcss/postcss-url) plugin * remove `alias` option, use [`resolve.alias`](https://webpack.js.org/configuration/resolve/) feature or use [`postcss-loader`](https://github.com/postcss/postcss-loader) with [`postcss-url`](https://github.com/postcss/postcss-url) plugin * update `postcss` to `6` version * minimum require `nodejs` version is `6.9` * minimum require `webpack` version is `4` #### [0.28.11](webpack/css-loader@v0.28.10...v0.28.11) (2018-03-16) ##### Bug Fixes * **lib/processCss:** don't check `mode` for `url` handling (`options.modules`) ([#​698](`https://github.com/webpack-contrib/css-loader/issues/698`)) ([c788450](webpack/css-loader@c788450)) #### [0.28.10](webpack/css-loader@v0.28.9...v0.28.10) (2018-02-22) ##### Bug Fixes * **getLocalIdent:** add `rootContext` support (`webpack >= v4.0.0`) ([#​681](`https://github.com/webpack-contrib/css-loader/issues/681`)) ([9f876d2](webpack/css-loader@9f876d2)) #### [0.28.9](webpack/css-loader@v0.28.8...v0.28.9) (2018-01-17) ##### Bug Fixes * ignore invalid URLs (`url()`) ([#​663](`https://github.com/webpack-contrib/css-loader/issues/663`)) ([d1d8221](webpack/css-loader@d1d8221)) #### [0.28.8](webpack/css-loader@v0.28.7...v0.28.8) (2018-01-05) ##### Bug Fixes * **loader:** correctly check if source map is `undefined` ([#​641](`https://github.com/webpack-contrib/css-loader/issues/641`)) ([0dccfa9](webpack/css-loader@0dccfa9)) * proper URL escaping and wrapping (`url()`) ([#​627](`https://github.com/webpack-contrib/css-loader/issues/627`)) ([8897d44](webpack/css-loader@8897d44)) #### [0.28.7](webpack/css-loader@v0.28.6...v0.28.7) (2017-08-30) ##### Bug Fixes * pass resolver to `localsLoader` (`options.alias`) ([#​601](`https://github.com/webpack/css-loader/issues/601`)) ([8f1b57c](webpack/css-loader@8f1b57c)) #### [0.28.6](webpack/css-loader@v0.28.5...v0.28.6) (2017-08-30) ##### Bug Fixes * add support for aliases starting with `/` (`options.alias`) ([#​597](`https://github.com/webpack/css-loader/issues/597`)) ([63567f2](webpack/css-loader@63567f2)) #### [0.28.5](webpack/css-loader@v0.28.4...v0.28.5) (2017-08-17) ##### Bug Fixes * match mutliple dashes (`options.camelCase`) ([#​556](`https://github.com/webpack/css-loader/issues/556`)) ([1fee601](webpack/css-loader@1fee601)) * stricter `[@import]` tolerance ([#​593](`https://github.com/webpack/css-loader/issues/593`)) ([2e4ec09](webpack/css-loader@2e4ec09)) #### [0.28.4](webpack/css-loader@v0.28.3...v0.28.4) (2017-05-30) ##### Bug Fixes * preserve leading underscore in class names ([#​543](`https://github.com/webpack/css-loader/issues/543`)) ([f6673c8](webpack/css-loader@f6673c8)) #### [0.28.3](webpack/css-loader@v0.28.2...v0.28.3) (2017-05-25) ##### Bug Fixes * correct plugin order for CSS Modules ([#​534](`https://github.com/webpack/css-loader/issues/534`)) ([b90f492](webpack/css-loader@b90f492)) #### [0.28.2](webpack/css-loader@v0.28.1...v0.28.2) (2017-05-22) ##### Bug Fixes * source maps path on `windows` ([#​532](`https://github.com/webpack/css-loader/issues/532`)) ([c3d0d91](webpack/css-loader@c3d0d91)) #### [0.28.1](webpack/css-loader@v0.28.0...v0.28.1) (2017-05-02) ##### Bug Fixes * allow to specify a full hostname as a root URL ([#​521](`https://github.com/webpack/css-loader/issues/521`)) ([06d27a1](webpack/css-loader@06d27a1)) * case insensitivity of [@​import] ([#​514](`https://github.com/webpack/css-loader/issues/514`)) ([de4356b](webpack/css-loader@de4356b)) * don't handle empty [@​import] and url() ([#​513](`https://github.com/webpack/css-loader/issues/513`)) ([868fc94](webpack/css-loader@868fc94)) * imported variables are replaced in exports if followed by a comma ([#​504](`https://github.com/webpack/css-loader/issues/504`)) ([956bad7](webpack/css-loader@956bad7)) * loader now correctly handles `url` with space(s) ([#​495](`https://github.com/webpack/css-loader/issues/495`)) ([534ea55](webpack/css-loader@534ea55)) * url with a trailing space is now handled correctly ([#​494](`https://github.com/webpack/css-loader/issues/494`)) ([e1ec4f2](webpack/css-loader@e1ec4f2)) * use `btoa` instead `Buffer` ([#​501](`https://github.com/webpack/css-loader/issues/501`)) ([fbb0714](webpack/css-loader@fbb0714)) ##### Performance Improvements * generate source maps only when explicitly set ([#​478](`https://github.com/webpack/css-loader/issues/478`)) ([b8f5c8f](webpack/css-loader@b8f5c8f)) --- </details> --- This PR has been generated by [Renovate Bot](https://renovatebot.com).
What kind of change does this PR introduce?
bugfix
Did you add tests for your changes?
yes
If relevant, did you update the README?
Summary
#529
Does this PR introduce a breaking change?
No.
Other information
We need more tests and good review on this.