Closed bperel closed 3 years ago
Hmm that is a bit puzzling. Why would it try to load the source map file at all?
Is this line actually verbatim what causes the error?
locale: require(`@uppy/locales/lib/fr_FR`),
or are you doing something like require(`@uppy/locales/lib/${currentLanguage}`)
?
I ask because from the stack trace, it looks like webpack is looking at the entire directory and not just the fr_FR
file:
@ ./node_modules/@uppy/locales/lib sync ^\.\/.*$
I don't know too much about webpack but this could explain why it's loading the source map files too.
If that is the case, you could try something like require(`@uppy/locales/lib/${currentLanguage}.js`)
(with the .js extension) to make sure it only looks at the js files.
If that is not the case, I don't have many ideas 😅 it would be really helpful if you could prepare a repository with a minimal reproduction that I could npm install
and try out.
Very well spotted @goto-bus-stop ! Indeed, I simplified the line to make my issue as clear as possible, but in the original source code the path is interpolated. And like you sugggest, the problem vanishes if I append the .js
extension to the require
call.
So, is the conclusion that it's a Webpack problem? I'm not familiar enough with Webpack to be confortable creating an issue in their repo.
This is (probably) intended behaviour in webpack. It's just that if you do
require('some/directory/' + filename)
webpack has to assume that filename
could be anything, including 'ar_AR.js.map'
, so it will bundle every file in that directory and decide the correct one at runtime.
If you do
require('some/directory/' + filename + '.js')
filename
could still be anything, but the result must end in .js
, so webpack knows to only bundle the JS files.
Alright, thanks! Closing.
Hello,
Until now I was using version 1.16.0 of @uppy/locales. Today I tried to update to the latest 1.16.* version. The install worked fine, but when launching my local server (the project is using Nuxt), the following warning appeared in the console :
(ellipsis added by me, all the contents of
node_modules/@uppy/locales/lib
is written there)It looks like the error is related to Webpack (as far as I understand from googling around), but I don't understand why the version change would trigger this issue (it shows up from version 1.16.1, but I didn't see any code changes compared to 1.16.0 apart from locale translations). Despite the warning, my application runs fine but I would still like not to see this gigantic warning each time the application gets hot-reloaded :-)
If it helps to track the source of the issue, the
Upload.vue
component that is mentionned in the stack trace looks like :