Babel передал код использовать абсолютный импорт

Транспортировка кода с использованием @babel/cli с помощью следующей команды:

babel --plugins @babel/plugin-transform-arrow-functions www/js/origin.js --out-file www/js/result.js

создает файл, который требует импорта с использованием абсолютного пути с моего компьютера. Конечно, выполнение этого на сервере обрывается, поскольку путь не найден.

Вот пример абсолютного импорта:

import _slicedToArray from "/Users/myself/project/node_modules/@babel/runtime/helpers/builtin/es6/slicedToArray";
import _createClass from "/Users/myself/project/node_modules/@babel/runtime/helpers/builtin/es6/createClass";
import _inherits from "/Users/myself/project/node_modules/@babel/runtime/helpers/builtin/es6/inherits";
import _possibleConstructorReturn from "/Users/myself/project/node_modules/@babel/runtime/helpers/builtin/es6/possibleConstructorReturn";
import _getPrototypeOf from "/Users/myself/project/node_modules/@babel/runtime/helpers/builtin/es6/getPrototypeOf";
import _classCallCheck from "/Users/myself/project/node_modules/@babel/runtime/helpers/builtin/es6/classCallCheck";
import _typeof from "/Users/myself/project/node_modules/@babel/runtime/helpers/builtin/es6/typeof";

Есть ли способ, чтобы перенесенный файл включал все, что ему нужно, встроенный?

Я не использую какой-либо конкретный babel.config.js или babelrc файл на данный момент.

12
задан Towkir 21 May 2019 в 20:54
поделиться