processing / p5.js-web-editor

The p5.js Editor is a website for creating p5.js sketches, with a focus on making coding accessible and inclusive for artists, designers, educators, beginners, and anyone else! You can create, share, or remix p5.js sketches without needing to download or configure anything.
https://editor.p5js.org
GNU Lesser General Public License v2.1
1.32k stars 1.27k forks source link

Implement Asset Modules in Webpack - Fixes #2023 #2957

Open adityagarg06 opened 6 months ago

adityagarg06 commented 6 months ago

This PR addresses issue #2023. Changes:

I have verified that this pull request:

lindapaiste commented 6 months ago

Thanks for working on this! I appreciate your notes on what you changed because that definitely helps us to review it.

I'm comparing this to closed PR #2026 and there are a few difference I notice. I'm not sure which one is correct off the top of my head - I need to look at some webpack docs.

adityagarg06 commented 6 months ago

Thanks for working on this! I appreciate your notes on what you changed because that definitely helps us to review it.

I'm comparing this to closed PR #2026 and there are a few difference I notice. I'm not sure which one is correct off the top of my head - I need to look at some webpack docs.

  • They removed file-loader etc from the package.json
  • They have a period between [name].[ext] but you have [name][ext]
  • They are using [hash] instead of [name] for image files in the production version. I'm not sure the implications of this or if it requires additional setup. At the moment we are using [name] so I doubt it's a problem to stick with that.

Hi @lindapaiste, I think there must be a period between the name and the extension. If the original file is "example.png", the output file would be "example.png" in the "images" directory but if we don't add a period the output file will be examplepng.

The first configuration with [hash] in the filename ensures cache busting by generating a unique filename based on the file content. This is useful for handling browser caching and ensuring that updated assets are fetched by clients.

The second configuration without a hash in the filename produces a consistent output filename based on the original file's name and extension.

adityagarg06 commented 6 months ago

I'm adding the period but I'm leaving the hash config up to you.