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

citation.js can't initiate #91

Closed
naivenaive opened this issue Jun 25, 2020 · 2 comments
Closed

citation.js can't initiate #91

naivenaive opened this issue Jun 25, 2020 · 2 comments
Labels
package: core type: bug Something isn't working

Comments

@naivenaive
Copy link

I am going to use the citation.js to write an extension. First, I tried to write a sample html and use the demo displayed in https://citation.js.org/. Here is the code:

<!DOCTYPE html>
<html>
<head>
    <script src="https://cdn.jsdelivr.net/npm/citation-js" type="text/javascript"></script>  
</head>
<body>
    <h1>TEST</h1>
     <script>
    	const Cite = require('citation-js')
    	let example = new Cite('Q21972834')
        let output = example.format('bibliography', {
		  format: 'html',
		  template: 'apa',
		  lang: 'en-US'
		})
	console.log(output)
    </script>
</body>
</html>

In the console, I get the following error:

citation-js:1 Uncaught TypeError: Failed to construct 'Response': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
    at new w (citation-js:1)
    at b (citation-js:1)
    at i (citation-js:1)
    at Array.map (<anonymous>)
    at Object.a (citation-js:1)
    at m (citation-js:1)
    at y (citation-js:1)
    at p.s [as add] (citation-js:1)
    at p [as set] (citation-js:1)
    at new p (citation-js:1)

Please help

@larsgw larsgw added type: bug Something isn't working package: core labels Jun 25, 2020
@larsgw
Copy link
Member

larsgw commented Jun 25, 2020

This seems to be caused by a tricky issue in Babel, which I can't fix right away. babel/babel#10063

larsgw added a commit to larsgw/sync-fetch that referenced this issue Jun 27, 2020
See citation-js/citation-js#91
See babel/babel#10063

BREAKING CHANGE: Changes Response and Request class names
@larsgw
Copy link
Member

larsgw commented Aug 29, 2020

This was fixed in 0.5.0-alpha.6.

@larsgw larsgw closed this as completed Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: core type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants