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

Bug: "hostname" is not exported by "__vite-browser-external", #254

Closed
drewbitt opened this issue Aug 6, 2023 · 11 comments · May be fixed by lkeff/airhornbot#5
Closed

Bug: "hostname" is not exported by "__vite-browser-external", #254

drewbitt opened this issue Aug 6, 2023 · 11 comments · May be fixed by lkeff/airhornbot#5
Labels
bug Something isn't working

Comments

@drewbitt
Copy link

drewbitt commented Aug 6, 2023

Describe the bug
Upgrading to 4.8.5 breaks my SvelteKit application when building

RollupError: "hostname" is not exported by "__vite-browser-external", imported by "node_modules/.pnpm/[email protected]/node_modules/tslog/dist/esm/runtime/nodejs/index.js".
    at error (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
    at Module.error (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:13604:16)
    at Module.traceVariable (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:14029:29)
    at ModuleScope.findVariable (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:12547:39)
    at Identifier.bind (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:8267:40)
    at CallExpression.bind (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:5850:23)
    at CallExpression.bind (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:9833:15)
    at Property.bind (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:5850:23)
    at ObjectExpression.bind (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:5846:28)
    at VariableDeclarator.bind (file:///C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:5850:23)

To Reproduce
Upgrade to 4.8.5
Try to build or run dev a vite project

Expected behavior
No error

Additional context
Downgrading to 4.8.2 removes the error. Did not try 4.8.3-.4

Node.js Version
20.5.0

OS incl. Version
Windows 10

@drewbitt drewbitt added the bug Something isn't working label Aug 6, 2023
@terehov
Copy link
Contributor

terehov commented Aug 6, 2023

Thank you. There is already a MR for that, I'll release an update in a few min.
Sorry about that.

#253

@drewbitt
Copy link
Author

drewbitt commented Aug 6, 2023

Great! I'd like an issue for the PR in the future so I don't waste time opening an issue, but that's alright :)

terehov added a commit that referenced this issue Aug 6, 2023
@terehov
Copy link
Contributor

terehov commented Aug 6, 2023

Can you try V4.8.6 please? thx

@terehov terehov closed this as completed Aug 6, 2023
@drewbitt
Copy link
Author

drewbitt commented Aug 6, 2023

I am getting the same error in 4.8.6.
RollupError: "hostname" is not exported by "__vite-browser-external", imported by "node_modules/.pnpm/[email protected]/node_modules/tslog/dist/esm/runtime/nodejs/index.js".

Also seeing
[plugin:vite:resolve] Module "os" has been externalized for browser compatibility, imported by "C:/Users/andys-pc/GitHub/MyStuff/Someplice/node_modules/.pnpm/[email protected]/node_modules/tslog/dist/esm/runtime/nodejs/index.js". See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.

There's no reason os should be externalized when it wasn't in 4.8.2

@drewbitt
Copy link
Author

drewbitt commented Aug 7, 2023

Let's re-open this.

@BCaspari
Copy link

BCaspari commented Aug 7, 2023

We also get this issue with 4.8.6, the problem persists...

@terehov
Copy link
Contributor

terehov commented Aug 7, 2023

I agree. What are the exact steps to reproduce it?

@terehov terehov reopened this Aug 7, 2023
terehov added a commit that referenced this issue Aug 7, 2023
@drewbitt
Copy link
Author

drewbitt commented Aug 7, 2023

Reproduction

pnpm create vite-extra tslog-hostname-bug --template ssr-vanilla-ts
cd tslog-hostname-bug
pnpm install
pnpm install tslog
# Add tslog command from README to counter
echo -e "import { Logger, ILogObj } from \"tslog\";\n\nconst log: Logger<ILogObj> = new Logger();\nlog.silly(\"I am a silly log.\");\n$(cat src/counter.ts)" > src/counter.ts
pnpm run build

Errors

@terehov
Copy link
Contributor

terehov commented Aug 7, 2023

Thank you. I found the problem in the package.json I fixed it. Releasing shortly

@terehov
Copy link
Contributor

terehov commented Aug 7, 2023

Can you try v4.8.7 please? thx

@terehov terehov closed this as completed Aug 7, 2023
@drewbitt
Copy link
Author

drewbitt commented Aug 7, 2023

Resolved in 4.8.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants