Skip to content

[GH-1] update build script for browser folder to use a relative import statement for script base folder - #2

Merged
PhaserEditor2D merged 5 commits into
phaserjs:mainfrom
devshareacademy:main
Dec 6, 2024
Merged

[GH-1] update build script for browser folder to use a relative import statement for script base folder#2
PhaserEditor2D merged 5 commits into
phaserjs:mainfrom
devshareacademy:main

Conversation

@scottwestover

Copy link
Copy Markdown
Contributor

Updated the build script to check if the import line for a file is referencing the editor scripts base package, and when there is a match the import statement will be changed from:

from "@phaserjs/editor-scripts-base.js";

to

from "../../phaserjs_editor_scripts_base/index.js";

This fix has a few limitations:

  • if any other npm packages are added to this library, this change will not fix those
  • the generated phaserjs_editor_scripts_quick needs to be placed next to the phaserjs_editor_scripts_base folder.

Added a note to the readme file about the placement of the folder.

Most of the file changes in the MR are the newly generated browser files that use the updated import statement.

Relates to #1

Updated the build script to check if the `import` line for a file is
referencing the editor scripts base package, and when there is a match
the `import` statement will be changed from:

```js
from "@phaserjs/editor-scripts-base.js";
```

to

```js
from "../../phaserjs_editor_scripts_base/index.js";
```

This fix has a few limitations:

* if any other npm packages are added to this library, this change will
not fix those
* the generated `phaserjs_editor_scripts_quick` needs to be placed
at the root of the phaser editor project, next to the original location
of the `phaserjs_editor_scripts_base` folder.

Signed-off-by: Scott Westover <scottwestover2006@gmail.com>
Re-ran the `build-browser.js` script so files use the updated import
path for the `@phaserjs/editor-scripts-base.js` npm package reference.

Signed-off-by: Scott Westover <scottwestover2006@gmail.com>
Updated the build script for the generated browser folder
updated readme to include a note about the placement of the generated browser folder for vanilla js projects.

Signed-off-by: Scott Westover <scottwestover2006@gmail.com>
@PhaserEditor2D

Copy link
Copy Markdown
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants