Skip to content
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

Remove the need to manually filter out source map files #246

Open
marekdedic opened this issue Oct 20, 2022 · 4 comments
Open

Remove the need to manually filter out source map files #246

marekdedic opened this issue Oct 20, 2022 · 4 comments

Comments

@marekdedic
Copy link
Contributor

Hi, I would like to open this feature request to ask to remove the need to manually get rid of sourcemaps when using with gulp-sourcemaps - it seems to me that if I'm using non-inlined sourcemaps, I would almost never want them to be treated as a separate file as opposed to piping them to gulp-sourcemaps.

I'm willing to submit a PR if the issue is discussed and a we agree on a solution.

@shama
Copy link
Owner

shama commented Oct 20, 2022

Isn't that handled by the webpack option devtool? https://webpack.js.org/configuration/devtool/

I'm not sure why this library would need to do extra handling of source maps.

@marekdedic
Copy link
Contributor Author

Hmm, maybe I didn't explain myself clearly - I'm talking about the need to do

.pipe(through.obj(function (file, enc, cb) {
      // Dont pipe through any source map files as it will be handled
      // by gulp-sourcemaps
      const isSourceMap = /\.map$/.test(file.path);
      if (!isSourceMap) this.push(file);
      cb();
}))

Webpack doesn't catre about streams - it just spits out the sourcemap. However, afaik, in gulp-sourcemaps, the sourcemap isn't actually a separate file, so the extra file needs to be removed by the code above.

@shama
Copy link
Owner

shama commented Oct 20, 2022

This library doesn't do anything with source maps though so I'm not sure why it would need to have this special circumstance. I think you could just configure webpack to output or not output the desired source maps or just keep doing that code above. I think that use case is outside the scope of this library.

@marekdedic
Copy link
Contributor Author

Hi, I think the use case is in scope - ultimately, the decision is of course yours, but I will try to change your mind by laying out my thought process:

I do want to produce sourcemaps. I'm using webpack-stream, a library that adapts webpack to a streaming interface (my understanding of its purpose, correct me if I'm wrong). From what I can gather, the standard way of handling source maps in gulp/streams is with the file.sourceMap property on the stream. I am trying to argue that webpack-stream should therefore adapt the webpack output to this format by default (althought changing the default now would be problematic, so let's not do that). As far as I understand this, that is not currently the case - I can either inline the sourcemap into the file itself by setting devtool: "inline-source-map" or have it as a separate file altogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants