1.2.3 • Published 6 years ago
@favi_ty/babel-plugin-esm-url-resolver v1.2.3
@favi_ty/babel-plugin-esm-url-resolver
add the js extension so that the import path can be executed as a URL
- only transpiling relative path. (may be only your repository sources)
- if the path already has an extensions, do nothing.
- if you importing
indexfiles, it must be specified/indexin the path strings.
Installation
yarn add -D @favi_ty/babel-plugin-esm-url-resolverUsage
"plugins": ["@favi_ty/babel-plugin-esm-url-resolver"]In
import * as src from "./module1";Out
import * as src from "./module1.js";Options
dirs?: String[]
include the path that starts with one of the values in the transformation target
{
"dirs": ["/src"]
}in:
import lib from "/src/lib";
import lib2 from "/src/node/lib2";
import lib3 from "src/node/lib3"; // that's not transform!out:
import lib from "/src/lib.js";
import lib2 from "/src/node/lib2.js";
import lib3 from "src/node/lib3"; // that's not transform!