rollup常用插件

rollup常用插件

徐徐
前端
发布于2024-11-22 16:17:27
🌺前言
rollup常用插件

  1. @rollup/plugin-commonjs 处理cjs模块
  2. @rollup/plugin-node-resolve 处理npm包
  3. @rollup/plugin-json 处理json编程es对象
javascript
import json from "@rollup/plugin-json";
import nodeResolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
export default {
  input: "src/index.js",
  output: [
    // {
    //   file: "dist/bundle-iife.js",
    //   format: "iife",
    // },
    {
    //   file: "dist/bundle-esm.js",
      dir:'dist',
      format: "esm",
    },
    // {
    //   file: "dist/bundle-amd.js",
    //   format: "amd",
    // },
    // {
    //     file: "dist/bundle-cjs.js",
    //     format: "cjs",
    //   },
  ],
  plugins:[
    json(),
    nodeResolve(),
    commonjs()
  ]
};
文章最后更新于 2024-12-03 17:02:30
留言
暂无数据

~~空空如也