我可以将 webpack 源映射和源代码文件放在单独的文件夹中吗? [英] Can I place webpack source maps and source code files in seprate folders?

查看:57
本文介绍了我可以将 webpack 源映射和源代码文件放在单独的文件夹中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了这个问题 生产中的源地图文件 - 是否安全?.我想用源代码在不同的文件夹中生成源映射文件.有没有办法用 webpack 做到这一点?我还阅读了此线程 用于在 WebStorm 中进行调试的相对 SourceMap 路径 并进行了测试但又失败了.

I read this question source maps files in production - is it safe?. I want to generate source map files in different folders with source code. Is there any way to do this with webpack? I also read this thread Relative SourceMap paths for debugging in WebStorm and tested but failed again.

推荐答案

您可以使用 output.sourceMapFilename 像这样:

You can use output.sourceMapFilename like so:

output: {
    filename: "bundles/[name].[chunkhash].min.js",
    sourceMapFilename: 'maps/[name].[chunkhash].map.js'
},

然后仅从 bundles 文件夹中提供服务.

and then serve only from the bundles folder.

这篇关于我可以将 webpack 源映射和源代码文件放在单独的文件夹中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆