parse-name-import

2.0.0 • Public • Published

parese-name-import

require node version >= 6.0

A script help you parse your file to transform whole module import to import only you need.

This is useful when the package you use support ES6 modules and you want to transform your old code to support ES6 modules import and save some space of your build file when using tree shaking(statically analyse the code and only include the bits of the library that are actually used).

For example transform

import THREE from "three";
const myMesh = new THREE.Mesh();

to

import { Mesh } from "three";
const myMesh = new Mesh();

Usage

node index.js [path] [replacedStatement]

To transform example above, all you need is do the following.

node index.js /src/ 'import THREE from "three";'

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    2
  • 1.1.1
    1
  • 1.1.0
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i parse-name-import

Weekly Downloads

5

Version

2.0.0

License

ISC

Last publish

Collaborators

  • tiansijie