Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fusepilot/babel-preset-cep
https://github.com/fusepilot/babel-preset-cep
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fusepilot/babel-preset-cep
- Owner: fusepilot
- Created: 2018-02-16T06:43:19.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T10:28:48.000Z (about 2 years ago)
- Last Synced: 2024-08-09T02:55:05.300Z (5 months ago)
- Language: JavaScript
- Size: 683 KB
- Stars: 4
- Watchers: 1
- Forks: 4
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# babel-preset-cep
## What
Babel preset intended for use with Adobe CEP Panels. It wraps `babel-preset-env` and provides ergonomic improvements working with NodeJS `require()` in the CEP panel context.
## Install
With NPM:
```sh
$ npm install --save-dev babel-preset-cep
```With Yarn:
```sh
$ yarn add --dev babel-preset-cep
```## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"presets": ["cep"]
}
```### Via CLI
```sh
$ babel script.js --presets cep
```### Via Node API
```javascript
require('babel-core').transform('code', {
presets: ['cep'],
});
```### NodeJS `require()`
Placeing `// node-require` above a `require()` statement will convert the statement to `cep_node.require()`. This is mainly useful for keeping Typescript type checking and intellisense working for extension node_module requires.
```typescript
// node-require
import fs = require("fs")
```Will transpile to:
```javascript
// node-require
var fs = window.cep_node.require("fs");
```