Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atom-community/rollup-plugin-atomic
Rollup plugin used in atom-ide-community
https://github.com/atom-community/rollup-plugin-atomic
rollup rollup-plugin zero-configuration
Last synced: about 2 months ago
JSON representation
Rollup plugin used in atom-ide-community
- Host: GitHub
- URL: https://github.com/atom-community/rollup-plugin-atomic
- Owner: atom-community
- License: mit
- Created: 2020-07-17T07:55:08.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-12T20:49:21.000Z (2 months ago)
- Last Synced: 2024-11-12T21:33:32.814Z (2 months ago)
- Topics: rollup, rollup-plugin, zero-configuration
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/rollup-plugin-atomic
- Size: 308 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rollup-plugin-atomic
Rollup plugin used in atom-ide-community
## Installation
```
npm install --save-dev rollup-plugin-atomic
```You should have the peer dependencies.
If using `npm`, the bundled Rollup, TypeScript, Babel, etc is hoisted automatically.
If using `pnpm`, either add the following to your `.npmrc` to hoist the prettier bundled with the config
```
public-hoist-pattern[]=*
```Or install these yourself in your `devDependencies`.
```
pnpm install -save-dev rollup
pnpm install --save-dev @babel/core typescript coffeescript assemblyscript # whichever you need
```## Usage
Create a `rollup.config.js` file at the root of the project with the following content. See API section for more details
```js
const { createPlugins } = require("rollup-plugin-atomic")const plugins = createPlugins(["ts", "babel"])
module.exports = {
input: "src/main.ts",
output: [
{
dir: "dist",
format: "cjs",
sourcemap: true,
},
],
plugins: plugins,
}
```## API
### createPlugins
use `createPlugins` to create the plugins you need.
```ts
createPlugins(inputPlugins: Array = ["ts", "babel", "json", "coffee"])
```which `inputPlugins` is among these:
```
js (considered by default)
ts
babel
coffee
json
css
wasm
as
visualizer
```Default plugins configured automatically:
```
commonjs
resolve
autoExternal
sourcemaps
terser (in production)
replace (in production)
```### Override Default Options for the plugins `[name, overriddenOptions]`
You can pass an input plugin with the overridden options using the `[name, overriddenOptions]` syntax.
```ts
const plugins = createPlugins([["ts", { tsconfig: "./lib/tsconfig.json" }], "js"])
```### Completely New Options for the plugins `[name, newOptions, false]`
You can pass an input plugin with their supported option using the `[name, newOptions, false]` syntax:
```ts
const plugins = createPlugins([
["ts", { tsconfig: "./lib/tsconfig.json", noEmitOnError: false, module: "ESNext" }, false],
"js",
])
```Passing false as the third argument results in discarding the built-in options of `rollup-config-atomic` for this plugin.
### Adding New Extra Plugins
For adding extra plugins, you can simply concatenate your plugins with the output of `createPlugins`
```ts
import multyentry from "@rollup/plugin-multi-entry" // an extra pluginconst plugins = [...createPlugins(["ts"]), multyentry()]
```