我使用Brunch内置的默认源映射。我看到文件很好,但我无法在源映射文件中点击断点。通过debugger;
使用Javascript对调试器的访问工作,这让我相信早午餐方面有问题。
这是我的brunch-config.js:
module.exports = {
files: {
javascripts: {
joinTo: {
'js/vendor.js': /^(?!source\/)/,
'js/app.js': /^source\//
},
entryPoints: {
'source/scripts/app.jsx': 'js/app.js'
},
order: {
before: /^(?!source)/
}
},
stylesheets: {joinTo: 'css/core.css'},
},
paths: {
watched: ['source']
},
modules: {
autoRequire: {
'js/app.js': ['source/scripts/app']
}
},
plugins: {
babel: {presets: ['latest', 'react']},
assetsmanager: {
copyTo: {
'assets': ['source/resources/*']
}
},
static: {
processors: [
require('html-brunch-static')({
processors: [
require('pug-brunch-static')({
fileMatch: 'source/views/home.pug',
fileTransform: (filename) => {
filename = filename.replace(/\.pug$/, '.html');
filename = filename.replace('views/', '');
return filename;
}
})
]
})
]
}
},
server: {
run: true,
port: 9005
}
};
我已尝试将配置的sourceMaps
属性设置为'old'
和'absoluteUrl'
以及'inline'
(请参阅Brunch config文档),但我仍未点击断点。
我运行命令brunch watch --server
,我正在使用Chrome。 Chrome Canary中的行为相同。我在Firefox中遇到了断点,没问题。
有趣的是,源地图文件看起来有一个基本的64字符串,如下所示:
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpb...
该映射似乎有效,但为什么我无法在Chrome devtools中点击断点?
MVCE可用。请遵循以下说明:
npm install
brunch build
(确保全局安装npm install brunch -g
)有关其他信息,请参阅我的package.json:
{
"version": "0.0.1",
"devDependencies": {
"assetsmanager-brunch": "^1.8.1",
"babel-brunch": "^6.1.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-rewire": "^1.0.0-rc-5",
"babel-plugin-transform-es2015-modules-commonjs": "^6.10.3",
"babel-plugin-transform-object-rest-spread": "^6.8.0",
"babel-preset-react": "^6.3.13",
"babel-register": "^6.11.6",
"browser-sync-brunch": "^0.0.9",
"brunch": "^2.10.9",
"brunch-static": "^1.2.1",
"chai": "^3.5.0",
"es6-promise": "^3.2.1",
"eslint-plugin-react": "^5.1.1",
"expect": "^1.20.2",
"html-brunch-static": "^1.3.2",
"jquery": "~2.1.4",
"jquery-mousewheel": "^3.1.13",
"mocha": "^3.0.0",
"nib": "^1.1.0",
"nock": "^8.0.0",
"oboe": "~2.1.2",
"paper": "0.9.25",
"path": "^0.12.7",
"pug": "^2.0.0-beta10",
"pug-brunch-static": "^2.0.1",
"react": "^15.2.1",
"react-dom": "^15.2.1",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
"redux-logger": "^2.6.1",
"redux-mock-store": "^1.1.2",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.1.0",
"reselect": "^2.5.3",
"spectrum-colorpicker": "~1.8.0",
"stylus-brunch": "^2.10.0",
"uglify-js-brunch": "^2.10.0",
"unibabel": "~2.1.0",
"when": "~3.4.5"
},
"dependencies": {
"jwt-decode": "^2.1.0",
"lodash": "^4.17.4",
"postal": "^2.0.5",
"rc-tree": "^1.3.9"
},
"scripts": {
"test": "mocha --compilers js:babel-register"
}
}
Issue在早午餐的Github上创建。
更新
通过修复@ JohannesFilter对this question的回答中指定的早午餐配置来解决。
答案 0 :(得分:1)
这是有效但相互冲突的早午餐配置的副产品。请参阅@JohannesFilter的这个question的答案。
从本质上讲,似乎<div class="productsresult">
<div class="products">
<p>.....</p>
<p>.....</p>
<p>.....</p>
</div>
</div>
<aside class="SideBar"></aside>
和files.joinTo
是相互排斥的,files.entryPoints
如果重叠,则会覆盖files.entryPoints
的输出。解决方案是选择一个或另一个,或确保它们不与他们正在处理的文件重叠。例如,这两个都是工作配置:
files.joinTo
或
entryPoints: {
'source/scripts/app.jsx': {
'js/vendor.js': /^(?!source\/)/,
'js/app.js': /^source\//
},
}