项目作者: rockchalkwushock

项目描述 :
Getting started with Rollup
高级语言: JavaScript
项目地址: git://github.com/rockchalkwushock/rollup-playground.git
创建时间: 2017-04-26T16:01:37Z
项目社区:https://github.com/rockchalkwushock/rollup-playground

开源协议:MIT License

下载


rollup-playground

:tada: Getting started with Rollup :tada:

This repository is following along with the video tutorial series from Jason Lengstorf which can be found here. There is a starter repository that can be found here.

Using this repository

A breakdown about the rollup.config.js can be found in learn.js. It is much different than the actual rollup.config.js as I was trying to make it as streamline as possible. Still wanting to find a way to process the whole library build with just one configuration and one script. learn.js is commented out and has links to the plugin repositories. Note that the mini-library does not use external packages hence no need for node-resolve in either of the configs.

  1. yarn build # generates all distributions of the code.
  2. yarn output # packages code & opens for local use.
  3. yarn sandbox # executes library's code.
  4. yarn run clean # removes all generated files.

My Notes

  1. When creating the rollup.config.js write in ES6, rollup expects this! Your ability to write certain features of ES6 will be dependant on your systems current node --v.

  2. Rollup does tree-shaking by default! If a module is not being used it will not be included in the bundled code.

  3. Order of plugins matters!!!

  4. Unfortunately babelrc-rollup does not accept an argument for specific environments or I would use this approach to resolve my issue of having all the builds processed by one config and one script.

Todos

  • Find away to include only the comments on functions that are being exported in the module.

Currently to remove all comments:

  1. cleanup() // remove all comments, etc.
  2. // or
  3. cleanup({ comments: ['jsdoc'] }); // too leave jsdoc comments.

but I still will get the comments from non-exported functions. :confused:

  • Find away to build the library with one rollup.config.js & one npm script.

rollup-plugin-multidest is a sound option; but I have not been able to incorporate the es build with this and still get the expected results throughout all files. BABEL_ENV=cjs is needed for all commonjs builds and I don’t want babel touching my code when building es.

Solved in this commit.