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

@import (inline, optional) fails with source maps enabled #2599

Closed
mmelvin0 opened this issue May 28, 2015 · 3 comments
Closed

@import (inline, optional) fails with source maps enabled #2599

mmelvin0 opened this issue May 28, 2015 · 3 comments
Labels

Comments

@mmelvin0
Copy link
Contributor

If I do the following:

@import (inline, optional) 'file.css';

When file.css is missing, LESS still tries to generate a source map and fails in SourceMapOutput.add since this._contentsMap[fileInfo.filename] is null for the optional, missing import.

Disabling source maps (or supplying file.css) allows the build to complete successfully.

@mmelvin0 mmelvin0 changed the title @import (inline, optional) with fails with source maps enabled @import (inline, optional) fails with source maps enabled May 29, 2015
@mmelvin0
Copy link
Contributor Author

I'm willing to try my hand at fixing this... any hints as to how I can tell during source map generation that an import was in fact optional?

@lukeapage
Copy link
Member

A simple guard around this._contentsMap[fileInfo.filename] might be okay.. That or better, look at where sourcemap gets its list of fileInfo's and make optional not present imports not add to that list (prob. In import manager or the import node)

@mmelvin0
Copy link
Contributor Author

I originally changed what Import.eval() was returning so it didn't have a null filename, but opted for this change to ImportVisitor instead as it seemed simpler and uses already existing hooks for skipping an import.

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

No branches or pull requests

4 participants