参考:
redux
reach-router
rollup-starter-lib
rollup-starter-app
roller-cli
create-react-library

一、安装
npm install --global rollup 二、命令:
rollup -c
默认指向rollup.config.js import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
import postcss from 'rollup-plugin-postcss';
import resolve from 'rollup-plugin-node-resolve';
import image from 'rollup-plugin-image';
import sizes from 'rollup-plugin-sizes';
// import env from 'rollup-plugin-env';
// import uglify from 'rollup-plugin-uglify'; import pkg from './package.json'; const external = Object.keys(pkg.dependencies || {}); export default {
input: 'src/index.js',
output: [
{
file: pkg.main,
format: 'cjs',
},
{
file: pkg.module,
format: 'es',
sourcemap: true,
},
],
plugins: [
// env({ NODE_ENV: 'production' }),
peerDepsExternal(),
postcss({
modules: true,
}),
image(),
babel({
exclude: 'node_modules/**', }),
resolve(),
commonjs({
include: 'node_modules/**',
namedExports: {
'node_modules/react/index.js': ['Component', 'PureComponent', 'Children', 'createElement'],
},
}),
// uglify(),
sizes({ details: true }),
],
external, // dependencies 内 不需要打包进去,运行时加载
}; 三、
rollyup 默认将相对路径加载, 如果想加载node_module 需要用rollup-plugin-node-resolve.
Rollup will only resolve relative module IDs by default.
If you do want to include the module in your bundle, you need to tell Rollup how to find it. In most cases, this is a question of using rollup-plugin-node-resolve. 四
Since most packages in your node_modules folder are probably legacy CommonJS rather than JavaScript modules, you may need to use rollup-plugin-commonjs: 五、
rollup-plugin-babel
在Babel实际编译代码之前,需要进行配置。 创建一个新文件src/.babelrc:

一、rollup的更多相关文章

  1. 冗余代码都走开——前端模块打包利器 Rollup.js 入门

    之前翻译过一篇文章,介绍了通过 ES2015 的解构赋值语法引入模块,可以让打包工具(browserify)最终编译出来的代码量最小化. 殊不知在 webpack 1.X 版本是无法利用该特性来避免引 ...

  2. SQLSERVER 使用 ROLLUP 汇总数据,实现分组统计,合计,小计

    表结构: CREATE TABLE [dbo].[Students]( ,) NOT NULL, ) NULL, [Sex] [int] NOT NULL, ) NULL, ) NULL, , ) N ...

  3. SQLSERVER中的ALL、PERCENT、CUBE关键字、ROLLUP关键字和GROUPING函数

    SQLSERVER中的ALL.PERCENT.CUBE关键字.ROLLUP关键字和GROUPING函数 先来创建一个测试表 USE [tempdb] GO )) GO INSERT INTO [#te ...

  4. SQL 2012 Group By Rollup, Grouping

    GO alter proc [zsp_BranchsData] as begin /* CREATE TABLE [原始机构数据] ( [序号] [varchar](50) NULL, [一级分行号] ...

  5. 【转】rollup、cub、grouping sets、grouping、grouping_id在报表中的应用

    摘自 http://blog.itpub.net/26977915/viewspace-734114/ 在报表语句中经常要使用各种分组汇总,rollup和cube就是常用的分组汇总方式. 第一:gro ...

  6. 分组 cube rollup NVL (expr1, expr2)

    cube  rollup NVL (expr1, expr2)->expr1为NULL,返回expr2:不为NULL,返回expr1.注意两者的类型要一致 NVL2 (expr1, expr2, ...

  7. 7.7 使用rollup子句

    --向rollup传递一列select division_id,sum(salary) from employees2 group by rollup(division_id); --向rollup传 ...

  8. 转:GROUPING SETS、ROLLUP、CUBE

    转:http://blog.csdn.net/shangboerds/article/details/5193211 大家对GROUP BY应该比较熟悉,如果你感觉自己并不完全理解GROUP BY,那 ...

  9. sql rollup解决责任人收支余额

    问题的提出是周聪之前问过我的项目往来查询,不好在NC上一次性查询到.然后我就搞了一个很长的项目对账,发布了NC的节点. 现在我做了总二的总账,每次领导问我项目还有多少钱,收了多少付了多少,我还要通过科 ...

  10. SQL Server 之 GROUP BY、GROUPING SETS、ROLLUP、CUBE

    1.创建表 Staff CREATE TABLE [dbo].[Staff]( ,) NOT NULL, ) NULL, ) NULL, ) NULL, [Money] [int] NULL, [Cr ...

随机推荐

  1. 局域网内通讯APP

    局域网内通讯APP [应用描述] 局域网内通讯是一款Android平台的实时通讯软件.提供基于无线局域网(WIFI)的实时通讯功能,支持发送文字.语音消息,支持实时语音及视频聊天.无需接入运营商网络, ...

  2. PHP 中的CURL 模拟表单的post提交

    废话不多说啦,直接上代码: <?php $data = ['username'=>'乔峰','skill'=>'擒龙手']; $headers = array('Content-Ty ...

  3. 日志收集ELK+kafka相关博客

    SpringBoot+kafka+ELK分布式日志收集 使用 logstash + kafka + elasticsearch 实现日志监控 Kibana 安装 与 汉化 windows系统安装运行f ...

  4. java-初识Properties

    1.通过代码了解一哈: package com.etc; import java.io.File; import java.io.FileInputStream; import java.io.Fil ...

  5. 解决: 移动端经mouseover显示出的弹层中链接点击问题

    通常我们会遇到这样的需求,导航菜单在鼠标划过的时候显示自定义弹层,在弹层中有一些链接需要点击后跳转或者其他一些事件.比如: $(".menu li").on("mouse ...

  6. Android 常驻广播和非常驻广播

    一.知识准备 ①常驻广播接受者:使用AndroidManifest.xml注册,接受者不随Activity的销毁而销毁,也就是拥有独立的生命周期. ②非常驻广播接受者:使用registerReceiv ...

  7. ORACLE如何检查找出损坏索引(Corrupt Indexes)

      在Oracle数据库中如何找出损坏索引呢? 下面我们人为构造一个案例,将索引块损坏.如下案例所示: SQL> create tablespace test_data   2  datafil ...

  8. 关于C#传给视图的字符串带有Html转义字符的处理

    public class PageBarHelper//分页类 { public static string GetPageBar(string requestHref,int totalCount, ...

  9. python3 Counter类(计数器)

    Counter(计数器):用于追踪值的出现次数 Counter类继承dict类,所以它能使用dict类里面的方法 创建一个Counter类 import collections obj = colle ...

  10. Centos7上安装docker (转)

    Centos7上安装docker Docker从1.13版本之后采用时间线的方式作为版本号,分为社区版CE和企业版EE. 社区版是免费提供给个人开发者和小型团体使用的,企业版会提供额外的收费服务,比如 ...