question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Source maps will not be generated when run the " webpack -p" command.

See original GitHub issue

Do you want to request a feature or report a bug?

Bug

What is the current behavior? With nothing to be changed, run the command webpack or webpack -p,I get source maps only when I execute the webpack command. The webpack -p will not generate the source map. If the current behavior is a bug, please provide the steps to reproduce. npm install => npm run cd => NO source maps. npm install => npm run cc => Yes. The webpack.config.js:

… new webpack.SourceMapDevToolPlugin({ filename: ‘srcMapPlugin/[file].map’, include: [‘js/test1.js’], append: ‘\n//#sourceMappingURL=http://192.168.32.5:8080/[url]’, moduleFilenameTemplate:‘[absolute-resource-path]’, }), devtool: false, …

package.json:

“scripts”: { “test”: “echo "Error: no test specified" && exit 1”, “v”: “webpack -version”, “cc”: ".\node_modules\.bin\webpack ", “cd”: “.\node_modules\.bin\webpack -p”, “cp”: “cross-env NODE_ENV=production PLATFORM=web .\node_modules\.bin\webpack --optimize-minimize” },

The sample is:

https://github.com/yincu/srcMapPlugin.git

What is the expected behavior? Source maps will be generated.

If this is a feature request, what is motivation or use case for changing the behavior?

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
sokracommented, Aug 25, 2017

When using the SourceMapDevToolPlugin you have to use the UglifyJsPlugin with sourceMap: true manually.

1reaction
ganapativscommented, Jan 10, 2018

@yincu You can pass options to configure SourceMapDevToolPlugin for nosources-source-map or hidden-source-map.

new webpack.SourceMapDevToolPlugin({
            test: [/\.js$/, /\.jsx$/],
            filename: '[file].map',
            append: false,
            noSources: true, // Sourcemap without source
            hidden: true
        })
Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack-dev-server doesn't generate source maps
This is mostly helpful when you're looking at the code Webpack has generated, and not so much when stepping through the debugger.
Read more >
Command Line Interface - webpack
Any parameters sent to the CLI will map to a corresponding parameter in the configuration file. ... --no-devtool, Do not generate source maps....
Read more >
Source maps in Node.js. Supporting the many flavors of…
Source maps provide a method for translating from generated source back to the original, via meta-information attached to the generated source; ...
Read more >
Bundling Extensions - Visual Studio Code
Passing the --minify flag and no --sourcemap compresses the code and creates ... esbuild or select Tasks: Run Task from the Command Palette...
Read more >
Webpack 5: Generate Source Maps using Webpack - YouTube
A source map is a way to map a combined or minified file back to its unbuilt state. Using source maps, you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found