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

cjs export problem #75

Open
KevinBrother opened this issue Nov 22, 2022 · 2 comments
Open

cjs export problem #75

KevinBrother opened this issue Nov 22, 2022 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@KevinBrother
Copy link

KevinBrother commented Nov 22, 2022

tsup generate cjs will wrap another key,such as 'src_default as default'.

So i bundle myself scripts will not work in cjs server mode.

Dose it work if you add server.js in cjs mode? Not esm mode server.mjs.

dirst/index.js
now:

export {
  src_default as default
};

i think it should be: (direct exposure function)

module.exports = src_default
@aleclarson
Copy link
Owner

Actually, in the latest version of this plugin, the dist/index.js file uses this:

exports.default = src_default;

If I understand you correctly, you are bundling your server to CJS and the dist/index.js file is causing you problems?

Need a reproduction

@aleclarson aleclarson added the waiting for response The issue author needs to reply label Nov 26, 2022
@KevinBrother
Copy link
Author

KevinBrother commented Dec 6, 2022

yes, you understand correctly.
image
it's work.
But i think should't do it like this. Because the export of 'vite-tsconfig-paths' should consistently, like react etc,in cjs and mjs.

const tsconfigPaths = require('vite-tsconfig-paths');
import tsconfigPaths from tsconfigPaths';

I think all the 'tsconfigPaths' up here are functions.

// not this
const {default} = require('vite-tsconfig-paths');

@aleclarson aleclarson added help wanted Extra attention is needed and removed waiting for response The issue author needs to reply labels Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants