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

Produced URL is "undefined" rather than expected URL. #54

Closed
Lattyware opened this issue Dec 10, 2018 · 6 comments · Fixed by #83
Closed

Produced URL is "undefined" rather than expected URL. #54

Lattyware opened this issue Dec 10, 2018 · 6 comments · Fixed by #83

Comments

@Lattyware
Copy link

Lattyware commented Dec 10, 2018

I have a bug that surfaced after updating css-loader, but is apparently a bug in extract-loader.

The issue:

After upgrading to 2.0.0 from 1.0.1, I am getting url(undefined) in my output CSS where I previously got a valid URL.

This seems to happen when the URL is referenced multiple times across imported files - after the first reference undefined is output.

  • Operating System: Arch Linux
  • Node Version: 11.3.0
  • NPM Version: 6.4.1
  • webpack Version: 4.27.1

Expected Behavior

The URL should be the same each time it is referenced.

Actual Behavior

undefined is output instead of the URL after the first reference.

Code

@import "./test2";

.test1 {
    background: url(../../assets/test.png);
}
.test2 {
    background: url(../../assets/test.png) repeat;
}

Produces:

.test2{background:url(d41d8cd98f00b204e9800998ecf8427e.png) repeat}.test1{background:url(undefined)}

How Do We Reproduce?

See the attached project.

And the response from the css-loader project - I assumed it was a problem on their end as it surfaced with the updated version, but apparently not:

Sorry not related to css-loader, problem in extract-loader, problem here https://github.com/peerigon/extract-loader/blob/master/src/extractLoader.js#L144, need rewrite logic, maybe use Object/Map (like { __EXTRACT_LOADER_PLACEHOLDER__000_000: 'asset.png' }) and get asset url based __EXTRACT_LOADER_PLACEHOLDER__000_000 index.

@yenshih
Copy link

yenshih commented Nov 18, 2019

Huge bug...
Any updates? May I take charge of this repo if it's currently unmaintained? @jhnns

@yenshih
Copy link

yenshih commented Dec 19, 2019

Still no response? :(

@klesun
Copy link

klesun commented Jan 14, 2020

@yenshih, if you are capable of taking charge of this project, would you mind filing a Pull Request to fix this issue, please? You are our only hope apparently.

@yenshih
Copy link

yenshih commented Jan 15, 2020

I've forked a repo and published extract-text-loader. @klesun

@klesun
Copy link

klesun commented Jan 15, 2020

Oh, cool, thanks, I guess this is it.

@geonanorch
Copy link

Thanks @yenshih , the new extract-text-loader fixed it for me.
I saw that there are new commits from @jhnns on extract-loader, so there is still hope that this issue gets fixed at the source and remove the need for a clone.

vseventer added a commit to vseventer/extract-loader that referenced this issue Apr 27, 2020
vseventer added a commit to vseventer/extract-loader that referenced this issue May 10, 2020
jannikkeye pushed a commit that referenced this issue May 26, 2020
* Use unique placeholders for each match - fixes #54 #57 #80

* Refactor pattern flow.
ngyikp added a commit to ricochetuniverse/ricochet-universe that referenced this issue Mar 26, 2022
This happened on another project I’m working on:
peerigon/extract-loader#54

Easiest solution is to stop using extract-loader and use an
alternative
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.

4 participants