-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
Webpack warns about an erroneous sourcemap path #487
Comments
Unfortunately, #467 isn't the only problem with sourcemaps in v5.1.0. A more serious problem is that the sourcemap doesn't actually map immer source files. See #489 with fix in #490 Anyway, back to the bad tslib in the sourcemap. I tried to figure out how to remove tslib from the sourcemap, but haven't been successful yet. Immer's tsconfig.json sets I think the right behavior here is simply to omit I'm not sure, however, who's actually injecting I suspect that someone more familiar with this chain of build tools might have a better idea which one is likely to be the culprit. The only clue I found was this note below in the docs of a different rollup typescript plugin (rollup-plugin-ts) than the one that immer is using.
So at least in that other rollup plugin, it's doing (or at least controlling) which TS helpers are emitted where. So maybe it's rolllup-plugin-typescript2 that controls the injection of helper code... and presumably sourcemaps? |
Should be fixed in 5.1.1. Thanks for the detailed reproduction, super helpful! |
@mweststrate - I don't think that b55ef46 fixes this issue. The bogus tslib path still shows up in the {"version":3,"file":"immer.module.js","sources":["../node_modules/tslib/tslib.es6.js","../src/common.ts","../src/scope.ts","../src/es5.ts","../src/proxy.ts","../src/patches.ts","../src/immer.ts","../src/index.ts"],"sourcesContent":["/*! I suspect that the root cause is that whoever is generating the sourcemap (per my comment above this may be TS, may be the rollup TS plugin, may be babel, may be rollup, etc.) is not properly handling the |
Update: after more investigation, bili seems like the most likely culprit for tslib showing up erroneously in the sourcemap. I filed egoist/bili#280 with details and a repro. |
@justingrant thanks for investigating and filing!
Yes, but since it is not used to locate the source (probably it is used for display sources, e.g. to name the files in the debugger), it is no problem. |
FWIW, I'm seeing something similar with parcel and immer 5.1.0: Hoping this goes away in 5.1.1 as well. It's just a warning, but it's ugly ;) |
@dkadrios - to get rid of this warning, egoist/bili#280 will have to be fixed (or immer would have to move off of bili, but I assume the former is easier!). If you (or someone you know) is a rollup expert and could track down what's going wrong in the way bili's rollup plugins and/or configuration, then you'd have a lot of grateful fans! I agree that the warning is a problem. In addition to ugliness, many devs prefer zero-warnings builds so that if an actual problematic issue pops up then it will be obvious and won't blend into a sea of ignored warnings. |
@mweststrate - sorry for delayed response, I;m still catching up from the holidays.
There's more to it. The This file-first preference exists because it makes a combined editor+debugger more useful:
Anyway, it's not a big deal but I did want to clarify that |
🎉 This issue has been resolved in version 5.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
🐛 Bug Report
When using immer 5.1.0 and source maps, webpack emits the following warning:
Link to repro
https://github.com/ivan-aksamentov/repro-immer-sourcemaps
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/ivan-aksamentov/repro-immer-sourcemaps cd repro-immer-sourcemaps yarn install yarn dev
(
yarn dev
is equivalent toNODE_ENV=development BABEL_ENV=development webpack
)Observed behavior
Webpack will emit the following warning:
The warning is due to incorrect
sources
path entry innode_modules/immer/dist/immer.module.js.map
:In this case, source map assumes that
tslib.es6.js
is available in../node_modules/tslib/tslib.es6.js
(that is inside<project_root>/node_modules/immer/node_modules/tslib
), but it may not be thecase, for example if using
yarn
as a package manager, which may hoistdependencies. In general, source maps should not make such assumptions.
Expected behavior
Webpack does not emit any warnings
Environment
Additional information
The text was updated successfully, but these errors were encountered: