-
-
Notifications
You must be signed in to change notification settings - Fork 199
Use faster SourceMap type #214
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
Comments
Hi @mneuhaus, Thank you for suggesting this change! The |
forgot to add the documentation link regarding an overview of all available options with their implications/speeds: https://webpack.js.org/configuration/devtool/#for-development |
I agree we should prefer |
btw, webpack explicit documents |
Hi, while I'm waiting for this change, is there a way to set this in the webpack.config.js file ? |
Hi @guillaume-a, You can modify everything you want in the generated Webpack config. // webpack.config.js
const Encore = require('@symfony/webpack-encore');
// Configure Encore
Encore
.setOutputPath('build/')
.setPublicPath('/')
// (...)
;
// Retrieve the config
const config = Encore.getWebpackConfig();
// Change the kind of source map generated in
// development mode
if (!Encore.isProduction()) {
config.devtool = 'eval-source-map';
}
// Export the config (be careful not to call
// getWebpackConfig() again)
module.exports = config; |
Ohhhh thank you so much. |
FYI, i tried to create a pull-request for eval-source-map yesterday but found out, that it is not capable to do css sourcemaps in conjunction with extractText. |
It may be worth noting that the use of |
I'd also be interested in measuring just how big of a difference it makes in some real projects by changing this setting. One sourcemap setting might be way faster than another, but, in practice, does this cut an initial build time down from 10 seconds to 2 seconds? Or from 10 seconds to 9.9 seconds (because the sourcemap was not the reason the build was slow)? If someone can try this on their project and drop the info here, that could help us make a smart decision. |
Webpack encourages to use 'source-map' as devtool. https://webpack.js.org/guides/production/#source-mapping
|
@olix21 In production only, which is what Encore currently does by default (if source maps are enabled): webpack-encore/lib/config-generator.js Lines 75 to 83 in 9a4030c
|
Refer to this page https://webpack.js.org/configuration/devtool/ (please check the development and production sections) different suggested tools exist which can meet different requirements. |
We could probably do that... but I don't really like that naming. In my opinion we should either:
|
Hi, is this still something relevant in 2025? |
Uh oh!
There was an error while loading. Please reload this page.
Currently encore uses "inline-source-map" as devtool setting to create SourceMaps in Development mode. This type of SourceMap is slow in initial build and rebuild.
I suggest encore should use one of these 2 by default:
cheap-module-eval-source-map medium build speed and fast rebuild speed while providing mapping down to specific lines of the code
eval-source-map slow build speed (same as current type) and pretty fast rebuild speed while mapping down to the exact original source code
Here are some numbers to compare the 3 variants on my MacBook Pro with a 2.7 Core i7:
The text was updated successfully, but these errors were encountered: