modular-typescript-import
v0.0.3
Published
Modular typescript import
Downloads
9
Readme
modular-typescript-import
Modular typescript import
Install
$ npm install --save modular-typescript-import
# or
$ yarn add modular-typescript-import
Usage
import modularTypescriptImport from 'modular-typescript-import'
modularTypescriptImport(options);
API
modularTypescriptImport([options])
Please read the source code for more informations.
CLI
$ npm install --global modular-typescript-import
$ modular-typescript-import --help
Usage
$ modular-typescript-import --pattern --dist
Options
--pattern glob pattern match your files [Default: src/**/*.@(tsx|ts)]
--dist the destination will write file to [Default: '']
Examples
$ modular-typescript-import --pattern test/*.tsx --dist dist
Demo
input
import * as React from 'react'
import { Button, message, Alert, Form, Layout } from 'antd';
declare interface DemoProps {
children?: React.ReactNode
}
declare interface DemoState { }
class Demo extends React.Component<DemoProps, DemoState> {
render() {
return (
<div className="Demo">
Component
</div>
)
}
}
export default Demo
output
import * as React from 'react'
const Button = require('antd/lib/button')
require('antd/lib/button/style/css')
const message = require('antd/lib/message')
require('antd/lib/message/style/css')
const Alert = require('antd/lib/alert')
require('antd/lib/alert/style/css')
const Form = require('antd/lib/form')
require('antd/lib/form/style/css')
const Layout = require('antd/lib/layout')
require('antd/lib/layout/style/css')
declare interface DemoProps {
children?: React.ReactNode
}
declare interface DemoState { }
class Demo extends React.Component<DemoProps, DemoState> {
render() {
return (
<div className="Demo">
Component
</div>
)
}
}
export default Demo
License
MIT © bang