error TS2306: File '.../webparts/jQuery/MyAccordionTemplate.ts' is not a module
Question
I am new to writing typescript or writing SP webparts. I have been following the Add jQueryUI Accordion to your SharePoint client-side web part
gulp serve provided Error - [tsc] src/webparts/jQuery/JQueryWebPart.ts(11,33): error TS2306: File 'C:/Code/jquery-webpart/src/webparts/jQuery/MyAccordionTemplate.ts' is not a module.
the error description points at instructions from section "To import the Accordion HTML" import MyAccordionTemplate from './MyAccordionTemplate';
From readings on the web, it seems to point at the way the path to the file is expressed. Any suggestions on how to fix this? #spfx-webparts
Environment details
- OS: [Windows 10 64bit]
- Framework: [Node.js 12.8.1]
- Browser(s): [Edge v80, FireFox v68.6]
- Tooling: [VS Code v1.43.2, SPFx v1.10.0]
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
I navigated to the location and noticed the file size was 0Kb. I deleted the MyAccordionTemplate.ts file and recreated it, ensuring it was at the same location as the JQueryWebPart.ts file. File size is 3Kb. Code has now compiled.
I encountered SPFX Web Part Error for the same error for the same demo. Hugo Bernier's answer suggested to check whether the file existed in the location. That's what made me check again. Thank you Hugo
Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues