mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-27 02:23:28 +08:00
fix(babel): Resolve require paths for presets, fix plugin ES6 support
This commit is contained in:
parent
3344223bfc
commit
dafe2d89ba
1 changed files with 8 additions and 1 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
var crypto = require('crypto')
|
||||
var path = require('path')
|
||||
var defaultOptions = require('../../static/babelrc.json')
|
||||
|
||||
var babel = null
|
||||
var babelVersionDirectory = null
|
||||
|
@ -12,6 +11,14 @@ var babelVersionDirectory = null
|
|||
// babel-polyfill.
|
||||
require('babel-regenerator-runtime');
|
||||
|
||||
// We run babel with lots of different working directories (like plugin folders).
|
||||
// To make sure presets always resolve to the correct path inside N1, resolve
|
||||
// them to their absolute paths ahead of time.
|
||||
var defaultOptions = require('../../static/babelrc.json')
|
||||
defaultOptions.presets = defaultOptions.presets.map((modulename) =>
|
||||
require.resolve(`babel-preset-${modulename}`)
|
||||
);
|
||||
|
||||
exports.shouldCompile = function (sourceCode, filePath) {
|
||||
return (filePath.endsWith('.es6') || filePath.endsWith('.jsx'))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue