Транспортировка кода с использованием @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
.