Skip to content
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

Fix webpack warnings due to unhandled extensions (LICENCE and README.md) #29869

Merged
merged 1 commit into from
Apr 8, 2024

Conversation

renchap
Copy link
Sponsor Member

@renchap renchap commented Apr 6, 2024

Prior to this fix, Webpack is showing those warnings because it does not know how to handle the README.md and LICENCE files in app/javascript/images.

The fix here is to use an allow list when requiring those. From what I understand, the require.context call here is to cause those assets to be processed by Webpack so they can be used without being references in a JS or CSS file.

WARNING in ./app/javascript/images/mailer-new/heading/README.md 1:15
Module parse failed: Unexpected token (1:15)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> Images in this folder are based on [Tabler.io icons](https://tabler.io/icons).
| 
 @ ./app/javascript/images sync ^\.\/.*$ ./mailer-new/heading/README.md
 @ ./app/javascript/mastodon/common.js
 @ ./app/javascript/packs/share.jsx

WARNING in ./app/javascript/images/mailer-new/welcome-icons/README.md 1:15
Module parse failed: Unexpected token (1:15)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> Images in this folder are based on [Tabler.io icons](https://tabler.io/icons).
| 
 @ ./app/javascript/images sync ^\.\/.*$ ./mailer-new/welcome-icons/README.md
 @ ./app/javascript/mastodon/common.js
 @ ./app/javascript/packs/share.jsx

WARNING in ./app/javascript/images/mailer-new/heading/LICENSE 1:4
Module parse failed: Unexpected token (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> MIT License
| 
| Copyright (c) 2020-2024 Paweł Kuna
 @ ./app/javascript/images sync ^\.\/.*$ ./mailer-new/heading/LICENSE
 @ ./app/javascript/mastodon/common.js
 @ ./app/javascript/packs/share.jsx

WARNING in ./app/javascript/images/mailer-new/welcome-icons/LICENSE 1:4
Module parse failed: Unexpected token (1:4)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> MIT License
| 
| Copyright (c) 2020-2024 Paweł Kuna
 @ ./app/javascript/images sync ^\.\/.*$ ./mailer-new/welcome-icons/LICENSE
 @ ./app/javascript/mastodon/common.js
 @ ./app/javascript/packs/share.jsx

@renchap renchap added this pull request to the merge queue Apr 8, 2024
Merged via the queue into mastodon:main with commit 730e212 Apr 8, 2024
31 checks passed
@renchap renchap deleted the fix-webpack-warnings branch April 8, 2024 08:22
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.

None yet

2 participants