-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
webpack bundling and "module has no exports" #162
Comments
Sorry about that, the named export was wrong on the UMD file. This is fixed in 10.0.2. |
Here's the issue: https://codesandbox.io/s/reverent-resonance-8sus4p?file=/src/index.ts All I did was clone the typescript-webpack template, the I added
to:
If the error wasn't happening, I would expect to see: NOTE: that project's webpack config is different than mine, but the common thing between the two is I use typescript, webpack 5, and see the same error when importing filesize. No need to rush a fix on this, just wanted to let people know of a temporary workaround!!! Thanks again! |
I am having the same issue. Thanks for the workaround @skratchdot! |
@avoidwork Hi! I created a pull request which should help with this problem |
@avoidwork I am getting the problem on compile with 10.0.2. We are using
|
@paulschreiber - Change:
to:
after you do that, you may or may not run into the error from this issue. |
ah, that was a typo. Everything is lowercase and we still have e error. Source: techmatters/terraso-web-client@main...fix/dependenecies-filesize
|
can anyone explain the issue? the module changed from a default export to a named export; is the umd the problem for web pack? would an iife solve the issue? I'm happy to do something to solve the issue, but is returning the default and removing the named the best solution? I can undo that change. |
Re-opening because I don't know if it's solved by returning the default export; 10.0.3 has the default export. |
@skratchdot thanks for that demo above, i'll see about making that a test case. |
webpack appears to be incompatible with the amd/umd/iife output from rollup, so as a quick fix i've removed the 'browser' key from package.json which lets webpack default to a better file to work with, and added this is 10.0.4. |
awesome! thank you @avoidwork . Removing "browser" was the only solution I knew of, but I figured you had some users that made use of it. It's fairly complicated to support all the different options I feel like. I tried looking for "standard" rollup configs, but didn't find much. i think due to how complicated it is to support everyone's setup, some people have just started supporting ESM only, and link to something like: you'd probably still get support requests if you did that though 🤣- so i like your solution of supporting commonjs and esm :) and umd people can still find those files in your dist folder. |
I also wanted to give you confirmation that |
Hey! First off thanks for making this great library!
I just tried upgrading
filesize
from v9 to v10.After changing my imports from:
to:
I thought things would work, but when I ran my app, I saw the following webpack error when visiting my site:
I was able to "fix" the issue by adding the following resolve alias to my webpack config:
My project is using typescript, and I think a fairly standard webpack setup.
I did a little searching, and I've seen a few people mention that changing the "browser" field from a string to a map might force webpack to pick the "module" over the "browser" field?
I think my build was using the browser field by default and that doesn't have exports?
webpack/webpack#4674 (comment)
https://github.com/defunctzombie/package-browser-field-spec
The text was updated successfully, but these errors were encountered: