angular2-logger
angular2-logger copied to clipboard
rollup failed: 'Logger' is not exported by node_modules/angular2-logger/core.js
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
Have you tried this @olivermuc? https://github.com/rollup/rollup-plugin-commonjs#custom-named-exports
Thx @langley-agm - will give it a shot shortly.
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.
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()
]
}