【发布时间】:2015-04-02 23:06:00
【问题描述】:
我的项目是一个 Laravel 站点,我将公共文件夹重命名为“html”。所以我的公共文件看起来像:
html
--js
----main.ts
html 在技术上是用于调试目的的站点根目录。
使用 browserify,我现在为 bundle.js 生成了一些源映射,其中包含 main.ts 的路径。问题是它们指向的是完整路径:
"html/js/main.ts"
通常,我可以将配置运行到html 文件夹并捕获断点。
http://myapp.app:8000 ->> project>html
但这并没有达到断点,因为html 文件夹在此设置中并不真正存在。奇怪的是,我可以在 Chrome 工具中设置断点,并且可以正常工作。如何设置 Webstorm 以使其在html 文件夹中达到断点?
编辑:
我将以下gist 用于我的源映射。
/**
* Browserify Typescript with sourcemaps that Webstorm can use.
* The other secret ingredient is to map the source directory to the
* remote directory through Webstorm's "Edit Configurations" dialog.
*/
'use strict';
var gulp = require('gulp'),
browserify = require('browserify'),
tsify = require('tsify'),
sourcemaps = require('gulp-sourcemaps'),
buffer = require('vinyl-buffer'),
source = require('vinyl-source-stream');
var config = {
client: {
outDir: './public/scripts',
out: 'app.js',
options: {
browserify: {
entries: './src/client/main.ts',
extensions: ['.ts'],
debug: true
},
tsify: {
target: 'ES5',
removeComments: true
}
}
}
};
gulp.task('client', function () {
return browserify(config.client.options.browserify)
.plugin(tsify, config.client.options.tsify)
.bundle()
.on('error', function (err) {
console.log(err.message);
})
.pipe(source(config.client.out))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write('./', {includeContent: false, sourceRoot: '/scripts'}))
.pipe(gulp.dest(config.client.outDir));
});
【问题讨论】:
标签: javascript typescript webstorm browserify