-
Notifications
You must be signed in to change notification settings - Fork 116
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
why not pass the transform sourcemap to webpack #154
Comments
If there was no map from the beginning and we provide a map, it will cause Webpack to throw an error on merging the sourcemap with null |
I make a change like these in - callback(null, res.code, map == null ? map : (res.map || map))
+ callback(null, res.code, res.map || map) |
I would need a reproduction to confirm this is a valid fix. |
@antfu Thank you for your replying. Here is my demo which can reproduct the problem. You can install the dependencies and the run the script Well, u can see this line. I console the transform result and the sourcemap is correct. But the final sourcemap is incorrect. |
Hi~ I'm now using unplugin to write a plugin and the plugin will be transformed to webpack plugin and esbuild plugin.
I only use one plugin to transform the
.jsx
file. In other words, there is only one loader to handle.jsx
file. So the transform function's param,map
isundefined
. But after I transform the.jsx
file, I get theres.map
value which is not theundefined
. I am confused why the unplugin use themap
first but not theres.map
?unplugin/src/webpack/loaders/transform.ts
Line 31 in f647af7
Here is how I use the unplugin transform hook:
https://github.com/ice-lab/ice-next/blob/f5755a0c0afdda87b97393ce6dc44f0ac9b4db84/packages/webpack-config/src/unPlugins/compilation.ts#L104
webpack loader load order: https://webpack.js.org/contribute/writing-a-loader/#complex-usage
The text was updated successfully, but these errors were encountered: