简体   繁体   English

源映射不适用于gofp中的coffeescript和webpack

[英]Sourcemaps don't work with coffeescript and webpack in gulp

I am writing an application in coffeescript and using gulp to build the frontend. 我正在用coffeescript编写一个应用程序并使用gulp来构建前端。 My current dev build looks like this 我当前的开发版本看起来像这样

gulp.task 'coffee', ->
    gulp.src('./coffee/*.coffee')
        .pipe do plumber
        .pipe sourcemaps.init()
        .pipe coffee bare: true
        .pipe sourcemaps.write()
        .pipe gulp.dest './pre-js/'

gulp.task 'webpack', ['coffee'], ->
    return gulp.src('pre-js/main.js')
        .pipe webpack require './webpack.config.js'
        .pipe gulp.dest 'dist/js/'

currently in coffee directory I only have two files main.coffee and styles.coffee , my webpack.config looks like this 目前在coffee目录中我只有两个文件main.coffeestyles.coffee ,我的webpack.config看起来像这样

module.exports = {
  entry: "./pre-js/main.js",
  output: {
    path: __dirname,
    filename: "main.js"
  },
  module: {
    loaders: [
      { test: /\.css$/, loader: "style!css" }
    ]
  },
  target: "web"
};

Before I added webpack my sourcemaps worked and I could easily track everything from the console. 在我添加webpack之前,我的源图工作正常,我可以轻松地从控制台跟踪所有内容。 Once I added webpack all console.log's are pointing at styles.coffee . 一旦我添加了webpack,所有console.log都指向styles.coffee I am noting that no minification is happening at this point. 我注意到目前还没有发生缩小。

How can I fix my build process to continue writing a modular application while being able to use the goodness of the sourcemaps? 如何修复构建过程以继续编写模块化应用程序,同时能够使用源图的优点?

缺少devtool: "source-map" webpack配置文件中的devtool: "source-map"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM