Rollup plugin used in atom-ide-community
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
Create a rollup.config.js
file at the root of the project with the following content. See API section for more details
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,
}
use createPlugins
to create the plugins you need.
createPlugins(inputPlugins: Array<Plugin> = ["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)
You can pass an input plugin with the overridden options using the [name, overriddenOptions]
syntax.
const plugins = createPlugins([["ts", { tsconfig: "./lib/tsconfig.json" }], "js"])
You can pass an input plugin with their supported option using the [name, newOptions, false]
syntax:
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.
For adding extra plugins, you can simply concatenate your plugins with the output of createPlugins
import multyentry from "@rollup/plugin-multi-entry" // an extra plugin
const plugins = [...createPlugins(["ts"]), multyentry()]