Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

iife bundle attempt with umd dependency yielding 'does not export default' #23

Closed
rosskevin opened this issue Feb 16, 2016 · 2 comments
Closed

Comments

@rosskevin
Copy link

Specifically, I'm importing bloodhound.js which appears to be a umd file.

Since I'm using rollup format: iife, is there something else I need to do to get the bloodhound UMD into a form that I can include with rollup?

Here's my current config:

//Executing rollup with options: 
{
    entry: 'app/assets/javascripts/application.js',
    sourceMap: true,
    format: 'iife',
    plugins: [
        babel({
            babelrc: false,
            presets: ['es2015-rollup']
        }),
        nodeResolve({
            // use "jsnext:main" if possible
            // – see https://github.com/rollup/rollup/wiki/jsnext:main
            jsnext: true,

            // use "main" field or index.js, even if it's not an ES6 module (needs to be converted from CommonJS to ES6
            // – see https://github.com/rollup/rollup-plugin-commonjs
            main: true,

            //skip: [ 'some-big-dependency' ], // if there's something your bundle requires that you DON'T want to include, add it to 'skip'

            // By default, built-in modules such as `fs` and `path` are treated as external if a local module with the same name
            // can't be found. If you really want to turn off this behaviour for some reason, use `builtins: false`
            builtins: false,

            // Some package.json files have a `browser` field which specifies alternative files to load for people bundling
            // for the browser. If that's you, use this option, otherwise pkg.browser will be ignored.
            browser: true,

            // not all files you want to resolve are .js files
            extensions: [ '.js', '.json' ]
        })
    ],
    dest: 'public/assets/debug/application.js'
}
@rosskevin
Copy link
Author

@related? rollup/rollup-plugin-commonjs#18
@related? rollup/rollup-plugin-commonjs#24

I've tried the following all with variations of the same error does not export:

// 1
import _bloodhound  from 'corejs-typeahead/dist/bloodhound'
const {Bloodhound} = _bloodhound

// 2
import Bloodhound  from 'corejs-typeahead/dist/bloodhound'

// 3
import {Bloodhound}  from 'corejs-typeahead/dist/bloodhound'

@rosskevin
Copy link
Author

wrong repo, moved to rollup/rollup#519

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

No branches or pull requests

1 participant