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

warning with webpack5 #1249

Closed
wwwwlm-work opened this issue Dec 30, 2020 · 8 comments · Fixed by #1273
Closed

warning with webpack5 #1249

wwwwlm-work opened this issue Dec 30, 2020 · 8 comments · Fixed by #1273

Comments

@wwwwlm-work
Copy link

Describe the bug

not ok when using webpack5.

Expected behavior

should use default export instead of named export

Actual behavior

there comes a warning as blow:
in /node_modules/esri-leaflet/src/EsriLeaflet.js
Should not import the named export 'version' (reexported as 'VERSION') from default-exporting module (only default export is available soon)
image

To Reproduce

using webpack5

Environment Information

  • Version of Leaflet (L.version): 1.7.1
  • Version of Esri Leaflet (L.esri.VERSION): 2.5.2
  • Your OS: window 10
  • Browser and Version Chrome 87.0.4280.88

Additional context

webpack: 5.11.0;

@gavinr
Copy link
Contributor

gavinr commented Dec 31, 2020

Thanks for the report - could you please post more specific replication steps?

@jgravois
Copy link
Contributor

@gavinr is right. a dummy application with the bare minimum code needed to reproduce the error would help the maintainers here focus on solving the problem instead of repro-ing the behavior you're reporting.

based on the information @wwwwlm-work already provided, its possible webpack@5 is finding fault with the current mix of named and default exports.

export default Request;

The rollup doc confirms that the practice is frowned upon: https://rollupjs.org/guide/en/#default-export

It is bad practice to mix default and named exports in the same module, though it is allowed by the specification.

i haven't given it much thought, but i'd expect the appropriate action to be getting rid of the default exports, not the other way around.

@wwwwlm-work
Copy link
Author

here is the demo repo to reproduce : https://github.com/wwwwlm-work/issue-demo

blow is what I did to prevent that warning temporarily:

// current
export {version as VERSION} from '../package.json';

// improved
import pkg from '../package.json'
const VERSION = pkg.version;
export { VERSION };

@Happytoad42
Copy link

Any update on this issue?

@daanielcarvalho
Copy link

Hello

There is any solution on this?

ERROR in ./node_modules/esri-leaflet/src/EsriLeaflet.js 2:0-51
Should not import the named export 'version' (reexported as 'VERSION') from default-exporting module (only default export is available soon)
 @ ./node_modules/esri-leaflet-geocoder/dist/esri-leaflet-geocoder-debug.js

when compiling webpack 5 get this erros, and this package is a dependency of other packages, forking it's not a solution.´

Thanks
Daniel

@gavinr
Copy link
Contributor

gavinr commented Mar 15, 2021

PRs welcome, I would suggest along the lines of @jgravois's suggestion:

i haven't given it much thought, but i'd expect the appropriate action to be getting rid of the default exports, not the other way around.

@destus90
Copy link
Contributor

destus90 commented May 24, 2021

Angular CLI version 12 is now shipped with Webpack 5 under the hood by default. So it gives us an error (not a warning) when using esri-leaflet in a such project :(

I pushed a PR that should fix this.

// @gavinr @jgravois

@gavinr
Copy link
Contributor

gavinr commented May 24, 2021

the fix from @destus90 was released in v3.0.2

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 a pull request may close this issue.

6 participants