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

Consider compile into es5 for cjs bundle #8

Closed
3Shain opened this issue Mar 23, 2021 · 3 comments
Closed

Consider compile into es5 for cjs bundle #8

3Shain opened this issue Mar 23, 2021 · 3 comments

Comments

@3Shain
Copy link

3Shain commented Mar 23, 2021

It raises error because my nodejs doesn't support ?. (version 12.16.3)

failed to load config from /Users/sanshain/realkairo/apps/solid-app/vite.config.ts
error when starting dev server:
/Users/sanshain/realkairo/node_modules/vite-plugin-solid/dist/cjs/index.js:29
      userConfig.resolve.alias = normalizeAliases(userConfig.resolve?.alias);
                                                                     ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:1047:16)
    at Module._compile (internal/modules/cjs/loader.js:1097:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/Users/sanshain/realkairo/apps/solid-app/vite.config.ts:30:43)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.require.extensions.<computed> [as .ts] (/Users/sanshain/realkairo/node_modules/vite/dist/node/chunks/dep-efe32886.js:46235:20)
@MrFoxPro
Copy link

Use babel

@3Shain
Copy link
Author

3Shain commented Mar 28, 2021

Use babel

I think you don't get my point. No sense to introduce babel here if I just want to use a node library.

This problem can be easily fixed by changing the target to es5 in tsconfig.json, or just use a higher version node.

@amoutonbrady
Copy link
Member

Hi @3Shain, I see your issue. I reckon I didn't put much thoughts into that as I considered that most environment using vite would end up using relatively recent version of node / browser. That being said this is a valid point that doesn't involve much changes.

I'll lower the target for CJS.

Thanks for bringing this to my attention and sorry for the delay :)

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