Closed baseplate-admin closed 1 week ago
Hello @baseplate-admin, could you please describe what is your use-case for this?
Hello @baseplate-admin, could you please describe what is your use-case for this?
Hi thanks for replying, the use case for map files is that when it's enabled, the original code shows up on the inspect element tab on browser.
If source maps are not enabled, it shows up minified codes ( even if i have sourcemap enabled in react
+ vite
).
Here's a blog post that dives deeper into this.
@baseplate-admin but why do you need the original code of html-entities
in your browser dev-tools? html-entities
should be a black-box for your project unless you are the html-entities
developer. You shouldn't need to waste browser resources to load and apply the source map. Is there something I'm missing?
Hi, sorry for not being clear. Let me try to clarify the purpose of source maps.
why do you need the original code of html-entities in your browser dev-tools?
Lets think a scenario like this: I got an error while using the html-entities
library. This might be an error in html-entities
(or an edge case). If i go over to console.log
, i will get a vague error that the error was originally from html-entities
, but without sourcemap, it is very hard to debug said error.
You shouldn't need to waste browser resources to load and apply the source map
Please note that sourcemap is only loaded when i open the dev-tools, otherwise it is ignored.
Please note that a developer can choose to disable source-map in their own project, in that case html-entities
's source-map will be disabled too. But i am talking about the opposite use-case, ie: developer wants source map in their project, in which case html-entities
looks like a jumbled mess.
I might not be able to clarify everything properly (sorry for that)
Here are some resources that might explain the need of source map:
Hello @baseplate-admin, please check version 2.5.0
. I've included source maps into that version.
Hi, please give me some time. I will see to it :)
@mdevils hey, webpack keeps complaining it can't find the .ts files for me from the source map in 2.5.0. Tried the latest @types/html-entities
with no luck:
WARNING in ./node_modules/html-entities/lib/index.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/terence/project/rgb-web-ui/node_modules/html-entities/src/index.ts' file: Error: ENOENT: no such file or directory, open '/home/terence/project/rgb-web-ui/node_modules/html-entities/src/index.ts'
WARNING in ./node_modules/html-entities/lib/named-references.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/terence/project/rgb-web-ui/node_modules/html-entities/src/named-references.ts' file: Error: ENOENT: no such file or directory, open '/home/terence/project/rgb-web-ui/node_modules/html-entities/src/named-references.ts'
WARNING in ./node_modules/html-entities/lib/numeric-unicode-map.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/terence/project/rgb-web-ui/node_modules/html-entities/src/numeric-unicode-map.ts' file: Error: ENOENT: no such file or directory, open '/home/terence/project/rgb-web-ui/node_modules/html-entities/src/numeric-unicode-map.ts'
WARNING in ./node_modules/html-entities/lib/surrogate-pairs.js
Module Warning (from ./node_modules/source-map-loader/dist/cjs.js):
Failed to parse source map from '/home/terence/project/rgb-web-ui/node_modules/html-entities/src/surrogate-pairs.ts' file: Error: ENOENT: no such file or directory, open '/home/terence/project/rgb-web-ui/node_modules/html-entities/src/surrogate-pairs.ts'
@tezhm I've got those warnings via webpack as well. As a temporary solution I've managed to suppress them with overrides in the package.json
:
"overrides": {
"webpack-dev-server": {
"html-entities": "2.4.0"
}
},
Hello @tezhm, @szmejk, thank you for reporting the problem. I've published a fix, please check version 2.5.2
.
Hi @mdevils ,
I did take a look around, it seems that typescript
-> javascript
transpilation adds some noise to the generated map file, could you please take a look at that?
@baseplate-admin could you please be more specific?
Sure, Lets start like this.
index.js
index.ts
So the problem is, when you are running tsc
to transpile files from ts
to js
, the resultant js
file doesn't contain the proper map of the ts
file
The easiest solution to me is to use something like esbuild
to transpile files from ts
to js
( or better vite
)
@baseplate-admin According to the package contents, index.js contains the link to the source map: https://www.npmjs.com/package/html-entities?activeTab=code
And the source map has a link to the source file:
And the source file is included to the package:
Can it be that your build-tool just ignores the source-map and removes the source map link comment?
Can it be that your build-tool just ignores the source-map and removes the source map link comment?
This could be the case too. But i am using vite
as build tool. I have never heard of this issue, nor had this issue in other packages that i use.
I will keep debugging and see what's causing this weird behavior
I'm closing this issue due to inactivity. Feel free to reopen in case if you have more information to share.
Hi,
Thanks for creating this awesome library. I was wondering if it was possible to add a map file for this repo.