Closed okhomenko closed 1 year ago
Please, provide some more info about your project's setup:
Webpack
/ source-map-loader
config?I tried to google the error message and it seems like it's just a false-positive warning by the latest CRA 5 / Webpack 5 release: https://github.com/mebjas/html5-qrcode/issues/396#issuecomment-1067145379 https://github.com/colinhacks/zod/issues/828#issuecomment-1005006072
You can hide it temporarly by setting GENERATE_SOURCEMAP
variable to false
in your app.
Based on links below, adding src
to the files
field in the package.json
might fix the warning on our side as well:
https://github.com/mswjs/interceptors/pull/204
https://github.com/mswjs/msw/issues/1030#issuecomment-1024251944
https://github.com/colinhacks/zod/pull/864
Or we can just remove .map
files from the build.
@maslianok I'm more leaning toward removing .map
files from the build, based on this discussion. What do you think?
Thanks @snelsi. For the time being I have disabled source maps for the package in my webpack config:
...
module: {
rules: [
{
test: /\.(j|t)sx?$/,
use: ['source-map-loader'],
enforce: 'pre',
exclude: [path.resolve(__dirname, './node_modules/react-resize-detector')],
},
...
In the source maps for esm
build you reference ts-files but the files are excluded from the build
We haven't published library sources to npm before. Does it mean that the library's source maps didn't work at all? ๐ฎ
Well, looks like it's a good idea to remove files that are useless ๐
Removed in v8.0.1 PR #229
Thanks @maslianok for a quick fix. Source maps are vey useful when I need to troubleshoot an issue.
They worked in v7. For each of the src/* files you had a section in sourcesContent
.
@okhomenko You are right, sourcesContent is null
is the new version for some reason.
Looks like to fix this is just a matter of adding inlineSources: true
to the tsconfig:
https://github.com/rollup/plugins/issues/260
Do we increase production build size by adding sourcemaps/sources to the module?
I did some testing and it seems my understanding of sourcemaps was correct. Sourcemaps are included ONLY in development builds. When you run "yarn build" in CRA it creates an optimized prod build without sourcemaps.
Firs run: current v8.0.1 build without sourcemaps
Second run: with sourcemap: true
& inlineSources: true
I suppose other modern libraries also follow this rule.
Can you confirm or deny this?
Can confirm that the only difference between the build with inlineSources: false
and inlineSources: true
are sourcesContent
field inside .map
files.
Either to include or exclude the source map files from the build decides the user, really. By default they are excluded in the majority of the prod builds.
Looks good to me to merge in the master ๐: https://github.com/maslianok/react-resize-detector/pull/230
Merged and published v8.0.2.
Thank you, @snelsi
@okhomenko please confirm that it works as you expected
Thanks @snelsi and @maslianok! It works as expected ๐