Open riprsa opened 2 months ago
Phaser Editor removes your imports in USER-IMPORTS
with Auto Import turned off because it is inside the COMPILED CODE
block. You can just add your imports before this block (at the very top of the file) and the editor won't remove them.
Either way, I also rarely enable auto-import because of that Phaser import warning. I think another solution to this issue would simply be fixing the Phaser import, which is invalid for some weird reason.
I get that some files having USER-IMPORTS
blocks and others not could feel like breaking a pattern. To be honest, I'm not too sure why USER-IMPORTS
exist when you can just add them before the COMPILED CODE
block
On Next.js 14.2.1 + App Router, with
Auto Import
option on for a scene, one could get the warningAttempted import error: 'phaser' does not contain a default export (imported as 'Phaser')
. While this warning does not stop the app from compiling, it is pretty annoying. To remove it, one needs to change the lineimport Phaser from 'phaser';
toimport { Phaser } from 'phaser';
.However, because the Editor hardcodes the former, one cannot use the option
Auto Import
. Without this option, any imports should be written above the compiled code (above the line/* START OF COMPILED CODE */
), otherwise Editor removes them. But, sadly, withAuto Import
turned on, one cannot use the block/* START-USER-IMPORTS */
-/* END-USER-IMPORTS */
, which structures the code a bit nicer.Examples:
IMO, such duality is unnecessary. If Phaser Editor will recognise and respect
START/END-USER-IMPORTS
always, then it would be a bit easier to use and comprehend. So, it would be great to have something like that: