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

rollup failed: 'Logger' is not exported by node_modules/angular2-logger/core.js #103

Open
olivermuc opened this issue Dec 21, 2016 · 4 comments

Comments

@olivermuc
Copy link

Following the install instructions & getting this with ionic 2:

[11:18:03]  ionic-app-scripts 0.0.48 
[11:18:03]  build dev started ... 
[11:18:03]  clean started ... 
[11:18:03]  clean finished in 4 ms 
[11:18:03]  copy started ... 
[11:18:03]  transpile started ... 
[11:18:07]  transpile finished in 3.75 s 
[11:18:07]  rollup started ... 
[11:18:07]  copy finished in 3.82 s 
[11:18:13]  rollup failed: 'Logger' is not exported by node_modules/angular2-logger/core.js (imported by 
            src/app/app.component.ts). For help fixing this error see 
            https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module 
@langley-agm
Copy link
Contributor

langley-agm commented Jan 1, 2017

@olivermuc
Copy link
Author

Thx @langley-agm - will give it a shot shortly.

@pdavin-zz
Copy link

I also have this problem and tried the rollup commonjs workaround, but now encounter this error:
Error parsing /....../node_modules/angular2-logger/app/core/level.ts: Unexpected token (9:7) in /....../node_modules/angular2-logger/app/core/level.ts

For some reason rollup is trying to parse a Typescript file from the core.js require. I don't know what to do about this.

@michel-zededa
Copy link

michel-zededa commented Mar 10, 2017

I must be doing something wrong, it's not working despite @olivermuc solution. Seems like it completely ignores 'namedExports'. Running 'rollup-plugin-commonjs' version '^8.0.0'. Anybody any clues?

'use strict';

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

import chalk from 'chalk';
const seen = new Set();
if (!process.stderr.isTTY) {
  chalk.enabled = false;
}
const warnSymbol = process.stderr.isTTY ? `Warning: ` : `Warning: `;
const stderr = console.error.bind(console);
const handleWarning = warning => {
  const str = warning.toString();
  if (seen.has(str)) {
    return;
  }
  seen.add(str);
  stderr(`${warnSymbol}${chalk.bold(warning.message)}`);
  if (warning.url) {
    stderr(chalk.cyan(warning.url));
  }
  if (warning.loc) {
    stderr(`${warning.loc.file} (${warning.loc.line}:${warning.loc.column})`);
  }
  if (warning.frame) {
    stderr(chalk.dim(warning.frame));
  }
  stderr('');
};

const warnFilter = /The 'this' keyword is equivalent to 'undefined'/;

export default {
  entry: './dist/out-tsc/src/main-aot.js',
  dest: 'aot/dist/build.min.js', // output a single application bundle

  sourceMap: true,
  sourceMapFile: 'aot/dist/build.min.js.map',

  treeshake: true,
  format: 'iife',

  onwarn: warning => {  // overwite the default warning function
    const str = warning.toString();
    if (warnFilter.test(str)) {
      return;
    }
    handleWarning(warning);
  },
  plugins: [
    nodeResolve({jsnext: true, module: true}),
    commonjs({
               include: [
                 'node_modules/rxjs/**',
               ],

               namedExports: {
                 'node_modules/angular2-logger/core.js': ['Logger', 'Options']
               }
             }),
    uglify()
  ]
}

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

No branches or pull requests

4 participants