inline-import.macro

0.1.4 • Public • Published

inline-import.macro

Downloads Version Babel Macro

The Problem

You want use a veriable once inline, but you have to import it at top of the file.

The Solution

This is a babel-plugin-macro which allows you import file inline.

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's devDependencies:

npm install --save-dev inline-import.macro

Usage

Once you've configured babel-plugin-macro you can import/require inline-import.macro.

Here are a few before/after examples:

import importPage from 'inline-import.macro';
const routes = [
  importPage('./aa'),
  importPage('./bb'),
  importPage('./cc'),
  importPage('./dd'),
];
import _dd from "./dd";
import _cc from "./cc";
import _bb from "./bb";
import _aa from "./aa";
const routes = [
  _aa,
  _bb,
  _cc,
  _dd]
;

Readme

Keywords

Package Sidebar

Install

npm i inline-import.macro

Weekly Downloads

0

Version

0.1.4

License

ISC

Unpacked Size

3.03 kB

Total Files

3

Last publish

Collaborators

  • yonghao.wang