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

JS API: Add Exception.loadedUrls #3629

Open
sod opened this issue Jul 4, 2023 · 2 comments
Open

JS API: Add Exception.loadedUrls #3629

sod opened this issue Jul 4, 2023 · 2 comments
Labels
enhancement New feature or request JS API About the shared JS API planned We would like to add this feature at some point

Comments

@sod
Copy link

sod commented Jul 4, 2023

Consider these 3 files:

# a.scss
@import './b.scss'

# b.scss
@import './c.scss'

# c.scss
.foo { color: $unknownVariable }

Bundling a.scss would roughly throw this exception:

Exception {
    message: 'Undefined variable',
    span: { url: new URL('c.scss') },
}

The bundler now knows a.scss (entry file) and c.scss (error.span.url) but b.scss isn't mentioned. So trying to fix the error in b.scss (remove the import or add the variable) woudn't trigger a rebuild.

This could be solved by returning the loadedUrls array on the exception so the bundler can watch all files that have been touched.

@sod
Copy link
Author

sod commented Jul 4, 2023

I'd do a PR to e.g. modify https://github.com/webpack-contrib/sass-loader/blob/master/src/index.js#L79-L90 to grant webpack the loadedUrls in case of an error.

@nex3 nex3 changed the title modern api: watcher can't recover from error in some cases due to lack of information JS API: Add Exception.loadedUrls Jul 5, 2023
@nex3 nex3 added planned We would like to add this feature at some point JS API About the shared JS API labels Jul 5, 2023
@nex3
Copy link
Contributor

nex3 commented Jul 5, 2023

We have this information in Dart and in the embedded protocol, but we don't currently expose it through the JS API and we should.

@nex3 nex3 added the enhancement New feature or request label Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request JS API About the shared JS API planned We would like to add this feature at some point
Projects
None yet
Development

No branches or pull requests

2 participants