"'FileUploader' is not exported by node_modules/ng2-file-upload/ng2-file-upload.js" #623
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@valorkin I am getting this error with aot and rollup
Error: "FileUploader is not exported by node_modules/ng2-file-upload/ng2-file-upload.js".
I am using the angular seed project by @mgechev. Is this a similar issue like valor-software/ng2-dragula#530 . Is there a way i can fix it.
Any update on this. I am getting the same error
I have customized build.bundles.app.rollup.aot file like this and it works:
`
import Config from '../../config';
import { writeFile } from 'fs';
import { join } from 'path';
const nodeResolve = require('rollup-plugin-node-resolve-angular');
const commonjs = require('rollup-plugin-commonjs');
const progress = require('rollup-plugin-progress');
const filesize = require('rollup-plugin-filesize');
const replace = require('rollup-plugin-replace');
const includePaths = require('rollup-plugin-includepaths');
const rollup = require('rollup');
const config = {
entry: join(Config.TMP_DIR, Config.BOOTSTRAP_FACTORY_PROD_MODULE),
sourceMap: true,
treeshake: true,
moduleName: 'main',
plugins: [
progress({
clearLine: false // default: true
}),
replace({
'process.env.NODE_ENV': JSON.stringify( 'production' )
}),
filesize(),
includePaths({
include: {},
paths: [join(Config.TMP_DIR, 'app')],
external: [],
extensions: ['.js', '.json', '.html', '.ts']
}),
nodeResolve({
es2015: true, jsnext: true, main: true, module: true, browser: true
}),
commonjs({
include: 'node_modules/**',
namedExports: {
'node_modules/immutable/dist/immutable.js': [ 'Map', 'Set', 'List'],
'node_modules/ngx-color-picker/dist/index.js': [ 'ColorPickerModule'],
'node_modules/ng2-file-upload/index.js': [ 'FileUploader']
}
})
]
};
export = (done: any) => {
rollup.rollup(config)
.then((bundle: any) => {
const result = bundle.generate({
format: 'iife'
});
const path = join(Config.TMP_DIR, 'bundle.js');
writeFile(path, result.code, (error: any) => {
if (error) {
console.error(error);
process.exit(0);
}
done();
});
})
.catch((error: any) => {
console.error(error);
process.exit(0);
});
};`
Nice, code formatting didn't work for some reason.. Anyway, problem is with named exports: https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
Thanks mate, I will try your solution!