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: Add explicit file extension to fix module resolution with Webpack #796

Merged
merged 2 commits into from
Jan 10, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jan 10, 2024

In some circumstances Webpack fails to resolve the module, this breaks e.g. forms 3.x.

So we need the explicit file extension to fix it.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@raimund-schluessler
Copy link

@susnux vitest has the same problem, see nextcloud/tasks#2450

@susnux susnux merged commit c2d3845 into master Jan 10, 2024
12 checks passed
@susnux susnux deleted the fix/make-module-resolution-explicit branch January 10, 2024 20:19
@ShGKme
Copy link

ShGKme commented Jan 15, 2024

It breaks Webpack build for Talk.

It cannot now require ('./locale/' + name); from the moment/min/moment-with-locales.js cause locales is not in the same directory and cannot be resolved from moment-with-locales.js.

WARNING in ./spreed/node_modules/moment/min/moment-with-locales.js 2159:16-50
Module not found: Error: Can't resolve './locale' in '<...>\talk-desktop\spreed\node_modules\moment\min'

@ShGKme
Copy link

ShGKme commented Jan 15, 2024

But I cannot understand how it was supposed to work in moment...

How it was possible what

require('./locale/' + name)

Worked from here

moment/
├── locale/
├── min/
│  ├── locales.js
│  ├── locales.min.js
│  ├── locales.min.js.map
│  ├── moment-with-locales.js           <-- from here
│  ├── moment-with-locales.min.js
│  ├── moment-with-locales.min.js.map
│  ├── moment.min.js                     
│  └── moment.min.js.ma

Without any configs in package.json or patching require...

@ShGKme
Copy link

ShGKme commented Jan 16, 2024

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

3 participants