最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to have a more readable bundle.js with webpack (sourcemap)? - Stack Overflow

programmeradmin1浏览0评论


I'm trying to make my first webpack project and I cannot find a way to change the numeric keys, which represent the modules in my output bundle.js, to a descriptive string so it will be easier to trace it in the debugger...

I have tried output.chunkFilename and output.sourceMapFilename without success.

This is how my gulp task looks like:

gulp.task('webpack', function (done) {
webpack({
    entry: {
        app: paths.src + "/main.js",
        vendor: ['react/addons', 'lodash']
    },
    output: {
        path: paths.dist,
        filename: "bundle.js",
        sourceMapFilename: '[file].js'
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin("vendor", 'vendor.bundle.js', Infinity)
    ]
}, function onWebpackComplete(err, stats) {
    if (err) throw new gutil.PluginError("webpack", err);
    done();
});
});

Is it even possible? am I using it wrong? Is there a better way?

Thanks!


I'm trying to make my first webpack project and I cannot find a way to change the numeric keys, which represent the modules in my output bundle.js, to a descriptive string so it will be easier to trace it in the debugger...

I have tried output.chunkFilename and output.sourceMapFilename without success.

This is how my gulp task looks like:

gulp.task('webpack', function (done) {
webpack({
    entry: {
        app: paths.src + "/main.js",
        vendor: ['react/addons', 'lodash']
    },
    output: {
        path: paths.dist,
        filename: "bundle.js",
        sourceMapFilename: '[file].js'
    },
    plugins: [
        new webpack.optimize.CommonsChunkPlugin("vendor", 'vendor.bundle.js', Infinity)
    ]
}, function onWebpackComplete(err, stats) {
    if (err) throw new gutil.PluginError("webpack", err);
    done();
});
});

Is it even possible? am I using it wrong? Is there a better way?

Thanks!

Share Improve this question asked Aug 7, 2015 at 13:11 Amit KaspiAmit Kaspi 8452 gold badges10 silver badges19 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 7

In your webpack.config.js file add exports.output.pathinfo = true

发布评论

评论列表(0)

  1. 暂无评论