mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
The excludeFile API was introduced in meteor-babel@7.8.1:
bfded57377
Modules that are evaluated before meteor-babel/register is configured
should not be transformed by meteor-babel, even if they are imported again
later, after meteor-babel/register has been configured.
If my analysis is correct, this change should prevent the dreaded
Must export a default export when using ES6 modules.
error, as seen most recently in
https://travis-ci.org/meteor/meteor/builds/638030190
and https://circleci.com/gh/meteor/meteor/40863.
41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
// This file exists because it is the file in the tool that is not automatically
|
|
// transpiled by Babel
|
|
|
|
"use strict";
|
|
|
|
function babelRegister() {
|
|
const meteorBabel = require("meteor-babel");
|
|
const path = require("path");
|
|
const toolsPath = path.dirname(__dirname);
|
|
const meteorPath = path.dirname(toolsPath);
|
|
const cacheDir = path.join(meteorPath, ".babel-cache");
|
|
const babelOptions = meteorBabel.getDefaultOptions({
|
|
nodeMajorVersion: parseInt(process.versions.node),
|
|
typescript: true
|
|
});
|
|
|
|
// Make sure that source maps are included in the generated code for
|
|
// meteor/tools modules.
|
|
babelOptions.sourceMaps = "inline";
|
|
|
|
require('meteor-babel/register')
|
|
.setCacheDirectory(cacheDir)
|
|
.setSourceMapRootPath(meteorPath)
|
|
.allowDirectory(toolsPath)
|
|
.setBabelOptions(babelOptions)
|
|
// Exclude files that are imported before we configure
|
|
// meteor-babel/register (including this very file).
|
|
.excludeFile(path.join(toolsPath, "index.js"))
|
|
.excludeFile(path.join(__dirname, "install-promise.js"))
|
|
.excludeFile(path.join(__dirname, "wrap-fibers.js"))
|
|
.excludeFile(path.join(toolsPath, "cli", "dev-bundle-bin-commands.js"))
|
|
.excludeFile(path.join(toolsPath, "cli", "dev-bundle-bin-helpers.js"))
|
|
.excludeFile(path.join(toolsPath, "cli", "flush-buffers-on-exit-in-windows.js"))
|
|
.excludeFile(path.join(toolsPath, "cli", "convert-to-os-path.js"))
|
|
.excludeFile(__filename);
|
|
}
|
|
|
|
babelRegister(); // #RemoveInProd this line is removed in isopack.js
|
|
|
|
require("./install-runtime.js");
|