-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Double reload because sourceURL is added to webpack watched files #141
Comments
Something wrong with pipeline, I can't answer, because i don't know it, no new options, this loader will be part of core and adding |
I uploaded an example repository over here: https://github.com/vespakoen/webpack-sourcemap-loader-issue-repo To test it out, install yarn, and run:
Then visit http://localhost:8080 and change the "Hello" string in I understand that the "normal usage" is using I guess I would just like to understand why the sourceURL is added to webpack, because I think it is not needed. |
What about if you don't use ts-loader or other tools? |
That actually IS the use case right here, I am only using the source-map-loader and webpack is only used for bundling the already compiled by typescript files. however, the source map loader adds the typescript source files to the webpack watch process (which I dont want webpack to be aware of) causing a double reload. Hope this makes sense... |
Why do not use:
In this case? |
Or you can ignore
|
source-map-loader should always add |
Hello @alexander-akait, I am facing a similar issue because I am using Haxe to transpile to JavaScript. I tried adding the directory with the source code to the ignored list as you proposed. However, Webpack still detects changes on the files under the |
@MangelMaxime Should work, can you provide repo/example? |
Sure, I made a reproduction available here: https://github.com/MangelMaxime/SourceMapLoaderProblemReproductionHaxe The instruction are in the README. If you need more information don't hesitate :) |
@MangelMaxime simple:
|
maybe we need doc it |
or you can use |
|
@alexander-akait Thank you for your help |
I think we need document it here |
I hit the same issue as @vespakoen described. My app imports some JS files which have sourcemaps referencing TS files. When using source-map-loader, webpack watches the *.ts files and recompiles if I modify them. Setting |
Expected Behavior
Source files not added to webpack's dependencies
Actual Behavior
Source files are added
My question
I am using react-refresh and HMR and noticed that my code reloads twice, I am using typescript seperately from webpack, and use
tsc --watch
in the background which compiles typescript to JS (and also generated the sourcemaps).In another process, I have a very simple webpack config with a react refresh plugin and source-map-loader with the entry point pointing to the (typescript) compiled index.js file.
Now, I found that source-map-loader adds the source files (e.g. .tsx and .ts files) to webpack's dependencies (and thus they are watched as well).
Now, when I change a source file, webpack watch triggers, and when the typescript compiler finishes, webpack is triggered again because the compiled file is (naturally) in webpacks dependencies as well.
I wonder what can be done to improve this situation, perhaps we should add an option to this plugin to not add the source files as a dependency?
I also wonder what the actual use case of adding the sourceURL as a dependency is.
Hope anyone can show me the light =)
The text was updated successfully, but these errors were encountered: