mirror of
https://github.com/thinkjs/thinkjs.git
synced 2026-02-01 15:23:03 +00:00
Fea: get message under src when has error
This commit is contained in:
parent
3e5e04a243
commit
38f188611d
@ -9,7 +9,7 @@
|
||||
"scripts": {
|
||||
"test": "npm run eslint && npm run test-cov",
|
||||
"test-cov": "istanbul cover ./node_modules/mocha/bin/_mocha -- -t 20000 --recursive -R spec test/",
|
||||
"compile": "babel --presets es2015-loose,stage-1 --plugins transform-runtime src/ --out-dir lib/",
|
||||
"compile": "babel --presets es2015-loose,stage-1 --plugins transform-runtime src/ --out-dir lib/ --source-maps",
|
||||
"watch-compile": "npm run compile -- --watch",
|
||||
"watch": "npm run watch-compile",
|
||||
"prepublish": "npm run compile",
|
||||
|
||||
@ -126,13 +126,19 @@ export default class {
|
||||
filename: file,
|
||||
retainLines: retainLines,
|
||||
presets: ['es2015-loose', 'stage-1'].concat(this.options.presets || []),
|
||||
plugins: ['transform-runtime'].concat(this.options.plugins || [])
|
||||
plugins: ['transform-runtime'].concat(this.options.plugins || []),
|
||||
sourceMaps: true
|
||||
});
|
||||
if(!logged && this.options.log){
|
||||
think.log(`Compile file ${file}`, 'Babel', startTime);
|
||||
}
|
||||
think.mkdir(path.dirname(`${this.outPath}${think.sep}${file}`));
|
||||
fs.writeFileSync(`${this.outPath}${think.sep}${file}`, data.code);
|
||||
let basename = path.basename(file);
|
||||
let outputContent = data.code + '\n//# sourceMappingURL=' + basename + '.map';
|
||||
fs.writeFileSync(`${this.outPath}${think.sep}${file}`, outputContent);
|
||||
let relativePath = path.relative(this.outPath + think.sep + file, this.srcPath + think.sep + file);
|
||||
data.map.sources[0] = relativePath;
|
||||
fs.writeFileSync(`${this.outPath}${think.sep}${file}.map`, JSON.stringify(data.map));
|
||||
}
|
||||
/**
|
||||
* src file is deleted, but app file also exist
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user