Skip to content

PIMBA/inline-import.macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]
;

About

inline import macro for babel

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published