2016-12-14 71 views
1

我正在写一个应用程序在coffeescript和使用gulp构建前端。我现在的开发建设看起来像这样源代码不能使用咖啡和脚本在饮料

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/' 

目前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" 
}; 

之前,我加入的WebPack我sourcemaps工作,我可以轻松跟踪控制台中的所有内容。一旦我添加webpack,所有的console.log都指向styles.coffee。我注意到现在没有缩小的情况发生。

如何修复我的构建过程,以继续编写模块化应用程序,同时能够使用源图的优点?

+0

在webpack配置文件中缺少'devtool:“source-map”' – AntK

回答

0

missing devtool: "source-map" in webpack config file