question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rollup fails due to missing exports

See original GitHub issue

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior Using rollup with module importing NgxDatatableModule fails due to missing exports.

Warning: 'default' is imported from external module 'rollup' but never used
'ScrollbarHelper' is not exported by 'node_modules\@swimlane\ngx-datatable\release\services\scrollbar-helper.service.js'
'NgxDatatableModule' is not exported by 'node_modules\@swimlane\ngx-datatable\release\datatable.module.js'
'NgxDatatableModule' is not exported by 'node_modules\@swimlane\ngx-datatable\release\datatable.module.js'
'ScrollbarHelper' is not exported by 'node_modules\@swimlane\ngx-datatable\release\services\scrollbar-helper.service.js'
Error: 'NgxDatatableModule' is not exported by node_modules\@swimlane\ngx-datatable\release\index.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module

Expected behavior Rollup completes as normal.

Reproduction of the problem Include NgxDatatableModule in your module which is used by rollup.

What is the motivation / use case for changing the behavior? Would like to use this in production.

Please tell us about your environment: Windows 10, NPM 4.2, Node 7.9

  • Table version: 9.0.0

  • Angular version: 4.0

  • Browser: N/A

  • Language: Typescript 2.3

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
amcdnlcommented, May 5, 2017

Do we have a consensus on this? Open to changes to improve this…

1reaction
Niro003commented, Sep 27, 2017

In the commonjs plugin you can add the namedExports option, where you can add missing exports. https://github.com/rollup/rollup-plugin-commonjs#custom-named-exports Here my rollup-config.js:

import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs    from 'rollup-plugin-commonjs';
import uglify      from 'rollup-plugin-uglify';

export default {

  entry: 'src/main.js',
  dest: '../build.js', // output a single application bundle
  sourceMap: true,
  format: 'iife',
  onwarn: function(warning) {
    // Skip certain warnings

    // should intercept ... but doesn't in some rollup versions
    if ( warning.code === 'THIS_IS_UNDEFINED' ) { return; }

    // console.warn everything else
    console.warn( warning.message );
  },
  plugins: [
      nodeResolve({jsnext: true, module: true}),
      commonjs({
        namedExports: {
          'node_modules/@swimlane/ngx-datatable/release/index.js': ['NgxDatatableModule']
        },
        include: 
        ['node_modules/rxjs/**', 
        'node_modules/@swimlane/**']
      }),
      uglify()
  ]
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Bundling with Rollup fails due to missing export #689 - GitHub
i'm trying to bundle my project using redux-saga and stumbled upon an issue. using the node-resolve plugin for rollup and the { jsnext:...
Read more >
Rollup.js can not detect default exports when trying to build ...
When I am building the app, I see this error in the console. It seems Rollup can not detect default exports, I tried...
Read more >
How to Bundle JavaScript With Rollup — Step-by-Step Tutorial
Learn how to use Rollup as a smaller, more efficient alternative to webpack and Browserify to bundle JavaScript files in this step-by-step tutorial...
Read more >
@rollup/plugin-typescript - npm
Start using @rollup/plugin-typescript in your project by running `npm i ... typescript from '@rollup/plugin-typescript'; export default ...
Read more >
Module Bundling - Stencil.js
Sometimes, Rollup is unable to properly static analyze CommonJS modules, and it misses some named exports. Fortunately, there is a workaround we can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found