@kano/es6-resolution
v1.0.20
Published
Transforms your named ES6 Imports into resolved paths, allowing a browser to fetch the dependencies.
Downloads
9
Maintainers
Keywords
Readme
ES6 names resolution for servers
Transforms your named ES6 Imports into resolved paths, allowing a browser to fetch the dependencies.
Usage
const resolve = require('@kano/es6-resolution');
const body = `
import { Utils } from '@acme/my-lib/lib/utils.js';
`;
const upgradedBody = resolve(body, 'application/javascript', __dirname + '/index.js');
Will be translated to
import { Utils } from '../../node_modules/@acme/my-lib/lib/utils.js';
Browsers will be happy and no code compilation is needed