Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.1.0 broke ant-design style loading #445

Closed
davidlougheed opened this issue Dec 20, 2019 · 17 comments · Fixed by #449
Closed

v1.1.0 broke ant-design style loading #445

davidlougheed opened this issue Dec 20, 2019 · 17 comments · Fixed by #449

Comments

@davidlougheed
Copy link

davidlougheed commented Dec 20, 2019

  • Operating System: Ubuntu 18.04
  • Node Version: 10.17
  • NPM Version: 6.13.4
  • webpack Version: 4.41.4
  • style-loader Version: 1.1.1

Expected Behavior

ant-design styles show up as normal.

Actual Behavior

some styles do not get loaded.

Code

https://gist.github.com/davidlougheed/4d97bf9107a13dfb84c0f492624783e1

Project: https://github.com/c3g/chord_web

How Do We Reproduce?

  • Install style-loader 1.1.x
  • Run npm run watch
  • Try to load site; styles are broken

Before screenshot: http://dlougheed.com/Screenshot%20from%202019-12-20%2015-02-32.png
After screenshot: http://dlougheed.com/Screenshot%20from%202019-12-20%2015-05-21.png

davidlougheed added a commit to bento-platform/bento_web that referenced this issue Dec 20, 2019
@obartra
Copy link

obartra commented Dec 20, 2019

I'm running into similar visual changes when updating from 1.0.2 to 1.1.0

@nickbrit
Copy link

Looks like style-loader 1.1.x ignores files with the same name in different folders.
home.react.js:
import 'pages/home/styles.scss';

about.react.js:
import 'pages/about/styles.scss';

Only one of styles.scss will be imported.

@davidlougheed
Copy link
Author

davidlougheed commented Dec 20, 2019

In c7d6e3a an ID system for resources is added; I haven't looked closely but that seems to indicate to me that file names are being incorrectly used as complete IDs @nickbrit

@wang-fu
Copy link

wang-fu commented Dec 21, 2019

it`s looks like cached style by id in https://github.com/webpack-contrib/style-loader/blob/master/src/runtime/injectStylesIntoStyleTag.js#L61, at the same id with different content will be overwritten

@yangshun
Copy link

This is the PR responsible: #443

@yangshun
Copy link

After some investigation, I found that loaderUtils.stringifyRequest() does this:

> loaderUtils.stringifyRequest(this, '!!/Users/yangshun/Developer/style-loader/node_modules/css-loader/dist/cjs.js??ref--5-1!/Users/yangshun/Developer/style-loader/test/manual/src/bar/style.module.css')
!!../../../../node_modules/css-loader/dist/cjs.js??ref--5-1!./style.module.css
> loaderUtils.stringifyRequest(this, '!!/Users/yangshun/Developer/style-loader/node_modules/css-loader/dist/cjs.js??ref--5-1!/Users/yangshun/Developer/style-loader/test/manual/src/foo/style.module.css')
!!../../../../node_modules/css-loader/dist/cjs.js??ref--5-1!./style.module.css

The ID produced is the same, for two different CSS module files.

@alexander-akait
Copy link
Member

WIP on this

@alexander-akait
Copy link
Member

alexander-akait commented Dec 23, 2019

I am very tired, don't sleep 3 days and my depression kills me, if somebody want to investigate and fix it, feel free to send a PR, i will do it tomorrow, i can't do it today, sorry guys

@yangshun
Copy link

We appreciate your efforts in maintaining and pushing the webpack ecosystem to greater heights. Please take care!

@cenfun
Copy link

cenfun commented Dec 24, 2019

Looks like style-loader 1.1.x ignores files with the same name in different folders.
home.react.js:
import 'pages/home/styles.scss';

about.react.js:
import 'pages/about/styles.scss';

Only one of styles.scss will be imported.

same issue here.
but version 1.0.2 works

@DemonCloud
Copy link

new version style-loader 1.1.1 will lose to load less css module

same issue here.

but version 1.0.2 works

@otakustay
Copy link

I can confirm this issue prevents relative import of css files to load into DOM, this id used in addModulesToDom function looks like:

!!../../../node_modules/css-loader/dist/cjs.js??ref--5-oneOf-2-2!../../../node_modules/postcss-loader/src/index.js??ref--5-oneOf-2-3!../../../node_modules/less-loader/dist/cjs.js??ref--5-oneOf-2-4!../../../node_modules/style-resources-loader/lib/index.js??ref--5-oneOf-2-5!./index.less

Noticed that the last segment is ./index.less, a relative path which can be conflict with other components

@erdalstk
Copy link

erdalstk commented Dec 25, 2019

Also for DraftJs Editor Plugin css imports, the situation is same.

@alexander-akait
Copy link
Member

Today i am working on the problem, sorry for delay

@alexander-akait
Copy link
Member

Done https://github.com/webpack-contrib/style-loader/releases/tag/v1.1.2, please leave feedback, it is big refactoring so sometimes bugs happen

@davidlougheed
Copy link
Author

thanks for taking a look!

@ybiquitous
Copy link

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants