generator-spfx icon indicating copy to clipboard operation
generator-spfx copied to clipboard

Module parse failed: Unexpected token (1:0)

Open spevilgenius opened this issue 5 years ago • 7 comments

General Information

  • [*] Usage
  • [*] Development
  • [ ] Documentation
  • [ ] Feature Request

Specific generator

  • [ ] Addons
  • [ ] HandlebarsJS

What Version you are running?

  • NodeJS: 10.16.3
  • NPM: 6.11.2
  • @pnp/spfx: 1.9.0

Describe your problem

Clean install target is spo and gulp serve produces error: Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type.

spevilgenius avatar Aug 29 '19 12:08 spevilgenius

@dpevilgenius - Can you please share what options you have chosen for scaffolding the project? Screenshot of all options selected will do. Thanks 🙏

StfBauer avatar Aug 29 '19 16:08 StfBauer

Capture

I mostly chose defaults and targeted spo

spevilgenius avatar Aug 29 '19 17:08 spevilgenius

There is one strange thing in your screenshot. It seems to me like you never have been asked for the Framework to choose? And not even the other questions.

Can you please check if a .yo-rc file already in the folder exists? The create a subfolder and .yo-rc file mostly have some negative side effects. If there is a .yo-rc file already can you please share the content?

These are the questions from my test run on a blank and completely empty folder: Screenshot 2019-08-29 at 20 16 24

The best way is no matter if you use the Microsoft or this generator to start from a blank folder and leave do not create a subfolder. Thank you for help to understand what causes this issue.

StfBauer avatar Aug 29 '19 18:08 StfBauer

Yes, I didn't get most of those choices!! There was a .yo-rc file in the Repos folder but no idea how it got there!! Removed it and voila! Success! Well, mostly. I do receive: TS5069: Option 'declarationMap' cannot be specified without specifying option 'declaration' or option 'composite'.

But I can still serve and test so that's good!!

spevilgenius avatar Aug 29 '19 18:08 spevilgenius

Great @spevilgenius !!! You always get to .yo-rcfiles when you choose the create folder option. On in the folder you started and one exactly the same in the solution folder itself. Might some leftover.

What TypeScript generator have you chosen? That shows you this message.

StfBauer avatar Aug 29 '19 19:08 StfBauer

That message was just when I ran gulp serve. I chose the 3.5 version of TypeScript but that's it. To be honest, I wish I could do it without TypeScript at all. Just so used to the vue cli and javascript files without the added weight of TypeScript. Just my 2 cents!

spevilgenius avatar Aug 29 '19 19:08 spevilgenius

Yeah, understandable I currently think about maybe some future options to make the experience better.

StfBauer avatar Aug 29 '19 20:08 StfBauer