Socket
Socket
Sign inDemoInstall

create-rollup-config

Package Overview
Dependencies
476
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    create-rollup-config

提供alias,eslint,resolve,common,babel,replace,postcss等基本插件,引入方可传入同名属性进行相应的plugin配置(见[使用](#使用))


Version published
Maintainers
1
Install size
54.7 MB
Created

Readme

Source

rollup常用plugin基本配置

提供alias,eslint,resolve,common,babel,replace,postcss等基本插件,引入方可传入同名属性进行相应的plugin配置(见使用


dev模式

提供了基本的启动服务以及热更新功能,服务启动在http://127.0.0.1:8080,热更新默认监听./src目录

生产环境

提供uglify和filesize功能

使用

安装

yarn add cerate-rollup-config --dev

使用

// rollup.config.js
const path = require('path')
const baseConfig = require('create-rollup-config');

const config = baseConfig({
    alias: {
        $common: './src/common'
    },
    replace: {
        env: JSON.stringify(process.env.NODE_ENV)
    },
    serve: {
        port: 7001
    },
    livereload: {
        watch: '/src' // default
    }
})

export default [
    {
        input: './src/test.js',
        output: [
            {
                file: 'dist/test.js',
                format: 'cjs'
            }
        ],
        ...config
    }
]

package.json配置

{
    ...,
    "scripts": {
        "build": "cross-env NODE_ENV=production rollup -c ./rollup.config.js",
        "server": "cross-env NODE_ENV=development rollup -c ./rollup.config.js --watch",
        ...
    },
    ...
}

部分plugin介绍

postcss

默认开启了minimize功能

参考:rollup-config-postcss

html

将html文件转为字符串,并支持压缩

参考:rollup-plugin-string-html

License

MIT © hyhappy

Keywords

FAQs

Last updated on 24 Sep 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc