Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch to individual exports to facilitate tree-shaking #12

Closed
wants to merge 1 commit into from

Conversation

AutoSponge
Copy link

I was able to solve #7 with this rollup config:

import resolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs'

export default {
  entry: 'index.js',
  dest: 'bundle.js',
  format: 'iife',
  plugins: [
    resolve(),
    commonjs()
  ]
}

@hunterloftis
Copy link
Owner

Hey, somehow I missed this PR - thanks for providing it! I'll check it out shortly.

@tunnckoCore
Copy link

Better use ES6 import/export directly! Using the commonjs plugin may not work as expected. As I remember, it is kinda "official" that it is better to use es6 instead of cjs.

@AutoSponge
Copy link
Author

@tunnckoCore I agree but the library author produced cjs format and did not specify a willingness to publish pure ES6. Like I said, I did test the above config for proper tree-shaking.

@tunnckoCore
Copy link

tunnckoCore commented May 21, 2017

I don't understand what's the problem in anyway. It's just enough to use Rollup and release 3 bundles, no matter what type your codebase is. I described very great how it can be accomplished and everyone will win, plus real original tree-shaking by The Inventor of it.

@hunterloftis
Copy link
Owner

This convinced me there was enough interest to ship #14; I'd like to avoid config files, and just use package.json for building, for as long as possible.

@tunnckoCore
Copy link

Nothing will happen from config file of 3-4 lines. :) It's not so scary, but yea i understand such people - i hate this thing about Webpack and Rollup too - they require whole config file for most basic things such as

const uglify = require('rollup-plugin-uglify')
const gzip = require('rollup-plugin-gzip')

module.exports = {
  plugins: [uglify({ compress: { warnings: false } }), gzip()],
}

That's why i started @rolldown. :)

@hunterloftis
Copy link
Owner

Config files may start 3-4 lines, but they have a tendency to grow ;)

@tunnckoCore
Copy link

Rollup & Rollup's are exception. In most cases for library creation they are pretty simple, hence Webpack's approach sucks, reminds me Grunt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants