-
-
Notifications
You must be signed in to change notification settings - Fork 236
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
Failed to parse source map from file: Error: ENOENT: no such file or directory #1194
Comments
Duplicate of: rehypejs/rehype-raw#28 This appears to have been previously fixed, but no release has been made since the fix was merged. Anyone want to make a 7.1.3? |
I get a flood of these errors from my dev server if I open dev tools. If there's a fix merged already, it'd be awesome to get that release. @RReverser I see you've published before, could you push a new release? |
can we also maybe just turn sourcemaps off in the published package? @fb55 what do you think? i seem to remember you suggesting that too |
I believe we merged a PR that disabled source maps already? We haven't published a new release with it yet. As an alternative, I have recently started moving my packages to https://github.com/isaacs/tshy, which opts to add the source files to the package. |
Publishing the source maps would be best, imo. Is it as simple for this project as turning it on in the tsconfig? |
I think so yes. We seem to run TSC twice to create a cjs and esm build. So we should be able to just turn on source maps for both in the tsconfig |
Source maps only work with source files being added to the published package, so that would be the one additional change required. But I don't see a reason not to do so. |
The package is already pretty chunky. Id prefer to avoid bloating it any more Do we definitely need the source files alongside? I thought source maps were enough to tell the browser the info it needs |
We had only the source maps without source files before, this led to #831 For my own modules, my previous solution was to have the source root of the source maps point at the source files on GitHub (see my comment in the issue linked above). That is difficult to do with the TS monorepo setup, but we could work around it via separate builds. |
wasn't #831 just us forgetting to package up i guess im missing something |
Yes, you just need the source map. The |
Source maps have to be generated for each variant, so if download size is a concern, adding the source files to the package would avoid duplication in the source maps. edit: Thanks for pointing this out, didn't know about the flag! |
True – source maps weren't included in the first place as their source files wouldn't be resolved. |
If we had packaged up the map files, the sources would be resolved, no? You don't literally need the source files afaik, like Justin mentioned We just forgot to package up the map files |
We didn't set the |
I'm wondering if something still needs to be done on this issue or is it just waiting for a release? |
Hello is it a way to mute this warning until a release ? EDIT:
|
@fb55 do we just need to disable source maps or something here? Would be super helpful if you can make the call and push the new version out |
We get a long list of warnings each time parse5 is loaded, so this issue is a bit of a pain. The workaround @m-conti works on Mac but didn't work on our CI/CD running linux. Sadly my bash skills are pretty poor so instead wrote the following postinstall script to remove the source mapping: /**
* This script is used to remove source mapping directives in the parse5 library.
* See also: https://github.com/inikulin/parse5/issues/1194
*/
const fs = require('fs')
const path = require('path')
/**
* Remove source mapping directives from the given file.
*/
function removeSourceMapping(filePath) {
const data = fs.readFileSync(filePath, 'utf8')
const result = data.replace(/^\/\/# sourceMappingURL=.*$/gm, '')
fs.writeFileSync(filePath, result, 'utf8')
}
/**
* Remove source mapping from all files in the given directory.
*/
function removeSourceMappingFromDir(dir) {
fs.readdirSync(dir).forEach((file) => {
const fullPath = path.join(dir, file)
if (fs.statSync(fullPath).isDirectory()) {
removeSourceMappingFromDir(fullPath)
} else if (fullPath.endsWith('.js') || fullPath.endsWith('.ts')) {
removeSourceMapping(fullPath)
}
})
}
removeSourceMappingFromDir(path.join(__dirname, '..', 'node_modules', 'parse5')) |
Once the new version gets published soon, source maps will be disabled and this error should go away If we want to re-enable them some day, we can then do it in another pr and ensure nothing is missing etc |
Why?
I don't want to use sourceMap, I don't use sourceMaps, I just want the warnings gone to get my current work through deployment.
tried setting
GENERATE_SOURCEMAP=false
as some suggested, but it did not change anything.The text was updated successfully, but these errors were encountered: