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: Entry module "src/server.js" is implicitly using "default" export mode #54

Closed
zwergius opened this issue Sep 1, 2020 · 6 comments

Comments

@zwergius
Copy link

zwergius commented Sep 1, 2020

Since updating sapper I've been getting this warning:

Entry module "src/server.js" is implicitly using "default" export mode, which means for CommonJS output that its default export is assigned to "module.exports". For many tools, such CommonJS output will not be interchangeable with the original ES module. If this is intended, explicitly set "output.exports" to either "auto" or "default", otherwise you might want to consider changing the signature of "src/server.js" to use named exports only.

@thgh
Copy link
Owner

thgh commented Sep 1, 2020

Looks like you updated Rollup but not Sapper, the errors stems from rollup.config.js:

Solution see below

@thgh thgh closed this as completed Sep 1, 2020
@zwergius
Copy link
Author

zwergius commented Sep 2, 2020

Hi again,

I do have latest Sapper 0.28.3 and everything else updated to latest versions as well.

This warning appears when adding export default to "src/server.js" as described in the docs

@TheSimpleZ
Copy link

@thgh I don't understand if we're supposed to add "exports": "default" to the client object or as a param to the output() method. Either way doesn't seem to work, and I'm having the same issue as the others. Could you please re-open the issue?

@thgh
Copy link
Owner

thgh commented Dec 8, 2020

It should be a property of the output object: https://rollupjs.org/guide/en/#outputexports

@thgh thgh reopened this Dec 8, 2020
@TheSimpleZ
Copy link

I see.. Yeah, you're correct. Except it should be added to the output object under the server config, not the client.
This seems to make the issue go away.

export default {
client: {...},
server: {
	input: config.server.input(),
	output: {...config.server.output(), exports: 'default'},
...

@thgh
Copy link
Owner

thgh commented Dec 9, 2020

@TheSimpleZ Thanks for figuring it out, that makes way more sense 😛

Sidenote: another option is to write module.exports = instead of export default

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

No branches or pull requests

3 participants