Skip to content

Implement Asset Modules in Webpack - Fixes #2023 #2957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

adityagarg06
Copy link
Contributor

This PR addresses issue #2023.
Changes:

  • Replaced the file-loader with asset/resource.
  • Replaced raw-loader with asset/source.
  • Added the generator option to control the output path

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

@lindapaiste lindapaiste added Type:Task Tasks tied specifically to developer operations and maintenance Area:Optimization Category for site performance optimization and management labels Jan 26, 2024
@lindapaiste
Copy link
Collaborator

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.

@adityagarg06
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@raclim raclim mentioned this pull request Jun 14, 2024
4 tasks
@raclim raclim merged commit d82261a into processing:develop Aug 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:Optimization Category for site performance optimization and management Type:Task Tasks tied specifically to developer operations and maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants