参考:
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. JQuery官方学习资料(译):遍历JQuery对象和非JQuery对象

        JQuery提供了一个对象遍历的Utility方法$.each()和一个JQuery集合遍历方法.each(). $.each()     $.each()是一个通用的方法用来遍历对象和数组, ...

  2. [MySQL] mysql int后面的数字与前导零填充

    1.int或者tinyint等数值型字段的存储范围已经是固定的,和类型相关2.后面的数字只与显示有关,并且是在开启了zerofill前导零填充的前提下 3.显示的时候,在前面用0补全了 create ...

  3. C# 处理PPT水印(二)——去除水印效果(文本水印、图片水印)

    本文将对C#处理PPT幻灯片中的水印进一步说明和介绍.在C# 处理PPT水印(一)一文中,分享了如何插入水印效果的方法,包括插入文字水印效果.插入图片作为水印效果两种情况,那对于不需要水印效果的情况, ...

  4. zepto和jQuery on事件委托在苹果手机上的”坑“

    移动端用zepto做的页面,突然发现on绑定的click事件并没有触发,代码如下: <ul> <li class="a">1111111aaaaaaasss ...

  5. 关于HTTP中GET与POST的区别

    GET和POST是HTTP请求的两种基本方法,要说它们的区别,接触过WEB开发的人都能说出一二. 看似很简单,其实是一道送命题 “标准答案”: GET在浏览器回退时是无害的,而POST会再次提交请求. ...

  6. 教你快速撸一个免费HTTPS证书

    摘要: 免费 HTTPS 证书,了解一下? HTTPS 已成为业界标准,这篇博客将教你申请Let's Encrypt的免费 HTTPS 证书. 本文的操作是在 Ubuntu 16.04 下进行,使用 ...

  7. js 高级程序设计(笔记)

    第二章 1.为了避免浏览器在呈现页面时出现明显的延迟,现代Web 应用程序一般都把全部JavaScript 引用放在<body>元素中页面内容的后面. 第三章 1.ECMAScript 中 ...

  8. select2 下拉无法显示

    .select2-container--open{ z-index: 99999;}

  9. 解决一个Ubuntu中编译NEON优化的OpenCV的错误

    在Ubuntu 16中编译开启NEON优化的Opencv时,遇到libpng编译是使用汇编代码的错误,完整错误见文章末尾.通过查询发现解决方案是安装跨平台编译器,安装代码如下: sudo apt-ge ...

  10. 学习安卓开发[3] - 使用RecyclerView显示列表

    在上一篇学习安卓开发[2] - 在Activity中托管Fragment中了解了使用Fragment的好处和方法,本次记录的是在进行列表展示时RecyclerView的使用. RecyclerView ...