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

" cpexcel not found " angular 2 application with systemJS #547

Closed
smkart opened this issue Jan 30, 2017 · 5 comments
Closed

" cpexcel not found " angular 2 application with systemJS #547

smkart opened this issue Jan 30, 2017 · 5 comments

Comments

@smkart
Copy link

smkart commented Jan 30, 2017

Hi Guys,

I found error while exporting highcharts with Angular 2 application , It says cpexcel.js not found

My systemjs.config file looks as below :

(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/',
'vendor:': 'externallibs/'
},
// map tells the System loader where to look for things
map: {
// For Excel export
'jszip': 'npm:xlsx/jszip.js',
'xlsx': 'npm:xlsx/xlsx.js',
'saveAs': 'vendor:FileSaver/FileSaver.js',
}
meta: {
'jszip': {
exports: 'JSZip',
},
'xlsx': {
deps: ['jszip']
},
'saveAs': {
exports: 'saveAs'
},
}
});
})(this);

Error says " cannot find cpexcel.js " , When I see into the xlsx.js line no 10: causing the issue
When I change
cptable = require('./dist/cpexcel');
To
cptable = System.import('./dist/cpexcel');

It works perfectly fine, But I don't want to make changes with my local code
because every time when I install using npm I need to make changes again and again

I need a revised version from git which I can use when it is required , Few may also face the same issue with highcharts export , angular 2 and systermJS as module loader.

If any other fix please suggest me

Thanks in advance !

@leehung-net
Copy link

leehung-net commented Mar 4, 2017

i had same error

@SheetJSDev
Copy link
Contributor

@Mani2693 @loongdefect we are not familiar with systemjs, but if you have a very small demo we can take a look.

@leehung-net
Copy link

leehung-net commented Mar 11, 2017 via email

@SheetJSDev
Copy link
Contributor

@loongdefect you should not use readFile or writeFile in browser -- use read and write

@SheetJSDev
Copy link
Contributor

@Mani2693 The following systemjs config appears to work:

SystemJS.config({
	paths: {
		'npm:': '/usr/local/lib/node_modules/'
	},
	map: {
		'xlsx': 'npm:xlsx/xlsx.js',
		'fs': '@node/fs',
		'crypto': '@node/fs' 
	}
});

The fs and crypto really should be suppressed but it was not obvious how to suppress node modules in systemjs. We will be adding a systemjs demo shortly

saarCiklum pushed a commit to Folcon/js-xlsx that referenced this issue Aug 19, 2020
closes SheetJS#447 h/t @channara
closes SheetJS#453 h/t @Adtiv @paustint
closes SheetJS#538 h/t @hsbilgen
closes SheetJS#547 h/t @Mani2693
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

3 participants