Package Exports
- konan
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (konan) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
konan
Like detective but also supports ES6
importand more.
Install
yarn add konan
# or hey old school
npm install --save konanSupported syntax
requirecallimport/exportES6 modulesimport()Dynamic import- You can use all language features supported by babel parser, including
jsxsyntax by default
Usage
const konan = require('konan')
konan(`
import React, {Component} from 'react'
const vue = require('vue/dist/vue')
import('./my-async-module').then()
require(path.resolve('./'))
`)
/*
result =>
{
strings: ['react', 'vue/dist/vue', './my-async-module'],
expressions: ['path.resolve(\'./\')']
}
*/API
konan(input, [options])
input
Type: string object
Required: true
Source content as string or AST tree.
options
dynamicImport
Type: boolean
Default: true
You can disable detecting dynamic import()-ed modules.
parse
Type: object
Default: {sourceType: 'module', plugins: ['jsx', 'typescript', 'dynamicImport']}
babel parser parse options.
FAQ
What does konan stand for?
It stands for Meitantei Konan (名探偵コナン), the main character in Detective Conan.
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
Author
konan © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
egoistian.com · GitHub @egoist · Twitter @_egoistlily