cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver I
Resolver I

SyntaxError: export declarations may only appear at top level of a module

Hi all!

 

I'm newbie in custom visuals development so sorry for a stupid question may be.

I follow this instruction for creating a new custom visual.

I created the new project using the same way as instruction says. It works fine.

Well, I installed d3 library and added typings using command:

npm install @types/d3@3.5 --save-dev

My little project understands type d3 after that. But it does not work now.

I did a little research and saw the following message in browser console:2018-04-10_08-40-46.png

 

 

As I see the script crashes because export command appears at NOT top level of module.

I will be grateful for any help.

 

Thanks in advance,

Alexander.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: SyntaxError: export declarations may only appear at top level of a module

What version of d3 did you install?

 

Power BI Visuals Tools support d3v3 only.

We'd recommend to install d3v3:

npm i d3@3.5.5 @types/d3@3.5.36

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

3 REPLIES 3
Highlighted
Community Champion
Community Champion

Re: SyntaxError: export declarations may only appear at top level of a module

What version of d3 did you install?

 

Power BI Visuals Tools support d3v3 only.

We'd recommend to install d3v3:

npm i d3@3.5.5 @types/d3@3.5.36

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

View solution in original post

Highlighted
Resolver I
Resolver I

Re: SyntaxError: export declarations may only appear at top level of a module

Hello Ignat!

 

Thank you so much! It works.

I think it will be good to update this section of tutorial on Github.

It contains an example of d3 version 4.9.1 installation.

Thank you once again!

 

Regards,

Alexander.

Highlighted
Community Champion
Community Champion

Re: SyntaxError: export declarations may only appear at top level of a module

Hi Alexander,

 

Thank you for the feedback.

We're working on improving our documentation.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Community Summit Australia – Join Online!

Community Summit Australia – Join Online!

Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.

Top Solution Authors
Top Kudoed Authors