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

CommonJS builds of themes in ./packages #152

Open
XuluWarrior opened this issue Oct 19, 2024 · 5 comments
Open

CommonJS builds of themes in ./packages #152

XuluWarrior opened this issue Oct 19, 2024 · 5 comments

Comments

@XuluWarrior
Copy link

From what I can see, the themes in ./packages (e.g. jsonresume-theme-professional) all use ESM modules. Including when they are packaged and published to NPM.
And from what I can tell, these themes can't be consumed by resume-cli or resumed for this reason.

Would it be possible to build and publish CommonJS packages?

Or at least, could you say which resume tools can consume the "module" style themes

@levino
Copy link
Collaborator

levino commented Oct 20, 2024

Hm. Interesting. I think at the very least the package should have a "type": "module" in its package.json, should it not?

{
"private": false,
"name": "jsonresume-theme-professional",
"version": "0.0.0",
"main": "./src/index.js",
"license": "MIT",
"devDependencies": {
"@repo/eslint-config-custom": "workspace:^",
"react": "^18",
"styled-components": "^6"
},
"peerDependencies": {
"styled-components": "^6"
},
"scripts": {
"lint": "eslint ."
},
"dependencies": {
"prismjs": "^1.29.0",
"react-icons": "^5.0.1"
}
}

@levino
Copy link
Collaborator

levino commented Oct 20, 2024

To be honest, I have no idea from where the npm version has been published. Looks quite different from the code here.

@XuluWarrior
Copy link
Author

Hm. Interesting. I think at the very least the package should have a "type": "module" in its package.json, should it not?

I think "type": "module" would help. Except that when I tried it with node 22 (to be able to load ESM modules from CommonJS), I found that the npm package for jsonresume-theme-professional has untransformed JSX
e.g.

const html = renderToString(sheet.collectStyles(<Resume resume={resume} />));

It would seem a build still needs updating to make a usable theme.

@XuluWarrior
Copy link
Author

To be honest, I have no idea from where the npm version has been published. Looks quite different from the code here.

Actually I just tried following your link and I realised that there are two versions of jsonresume-theme-professional.
jsonresume-theme-professional and @jsonresume/jsonresume-theme-professional

I was using the former. The latter is actually has "type": "module; already set.
But I couldn't get it to work with resumed and node 22 because I get TypeError: styled.div is not a function

I haven't followed through any more to work out what is going on there.

@thomasdavis
Copy link
Member

thomasdavis commented Nov 12, 2024

So I've been trying to move towards having everything under the namespace going fourth @jsonresume

I'm a bit out of the loop with how to even publish packages anymore in the npm ecosystem. Ideally we support ESM/ MJS, and we also need a way to transpile and support typescript when it is used.

I'm going to do a bit of research right now...

https://chatgpt.com/share/67333906-6bf4-8008-adbf-32c10cb3db21

So painful, but probably needs to be done and documented for any packages coming out of this monorepo.

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