Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

675
Views
¿Cómo genero mapas fuente cuando uso babel y webpack?

Soy nuevo en el paquete web y necesito ayuda para configurar la generación de mapas fuente. Estoy ejecutando webpack serve desde la línea de comandos, que se compila correctamente. Pero realmente necesito mapas fuente. Este es mi webpack.config.js .

 var webpack = require('webpack'); module.exports = { output: { filename: 'main.js', publicPath: '/assets/' }, cache: true, debug: true, devtool: true, entry: [ 'webpack/hot/only-dev-server', './src/components/main.js' ], stats: { colors: true, reasons: true }, resolve: { extensions: ['', '.js', '.jsx'], alias: { 'styles': __dirname + '/src/styles', 'mixins': __dirname + '/src/mixins', 'components': __dirname + '/src/components/', 'stores': __dirname + '/src/stores/', 'actions': __dirname + '/src/actions/' } }, module: { preLoaders: [{ test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'jsxhint' }], loaders: [{ test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'react-hot!babel-loader' }, { test: /\.sass/, loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded&indentedSyntax' }, { test: /\.scss/, loader: 'style-loader!css!sass' }, { test: /\.(png|jpg|woff|woff2)$/, loader: 'url-loader?limit=8192' }] }, plugins: [ new webpack.HotModuleReplacementPlugin(), new webpack.NoErrorsPlugin() ] };

Soy realmente nuevo en el paquete web, y mirar los documentos realmente no ha ayudado, ya que no estoy seguro de a qué se debe este problema.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Para usar el mapa fuente, debe cambiar el valor de la opción devtool de true al valor que está disponible en this list , por ejemplo source-map

 devtool: 'source-map'

devtool : 'source-map' - Se emite un SourceMap.

over 4 years ago · Santiago Trujillo Report

0

Tal vez alguien más tenga este problema en algún momento. Si usa UglifyJsPlugin en el paquete webpack 2 , debe especificar explícitamente el indicador sourceMap . Por ejemplo:

 new webpack.optimize.UglifyJsPlugin({ sourceMap: true })
over 4 years ago · Santiago Trujillo Report

0

Configuración mínima del paquete web para jsx con mapas de origen:

 var path = require('path'); var webpack = require('webpack'); module.exports = { entry: `./src/index.jsx` , output: { path: path.resolve(__dirname,"build"), filename: "bundle.js" }, devtool: 'eval-source-map', module: {   loaders: [ { test: /.jsx?$/, loader: 'babel-loader', exclude: /node_modules/, query: { presets: ['es2015', 'react'] } } ] }, };

Ejecutándolo:

 Jozsefs-MBP:react-webpack-babel joco$ webpack -d Hash: c75d5fb365018ed3786b Version: webpack 1.13.2 Time: 3826ms Asset Size Chunks Chunk Names bundle.js 1.5 MB 0 [emitted] main bundle.js.map 1.72 MB 0 [emitted] main + 221 hidden modules Jozsefs-MBP:react-webpack-babel joco$
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!