"'FileUploader' is not exported by node_modules/ng2-file-upload/ng2-file-upload.js" #623

Open
opened 2017-02-07 08:41:40 +00:00 by gomesNazareth · 4 comments
gomesNazareth commented 2017-02-07 08:41:40 +00:00 (Migrated from github.com)

@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.

@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.
albpara commented 2017-07-23 22:07:20 +00:00 (Migrated from github.com)

Any update on this. I am getting the same error

Any update on this. I am getting the same error
rikup88 commented 2017-08-07 07:32:26 +00:00 (Migrated from github.com)

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);
});
};`

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); }); };`
rikup88 commented 2017-08-07 07:33:33 +00:00 (Migrated from github.com)

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

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](https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module)
albpara commented 2017-08-20 19:27:53 +00:00 (Migrated from github.com)

Thanks mate, I will try your solution!

Thanks mate, I will try your solution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#623