2016-12-14 70 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