Skip to content

[Bug?]: Websocket with resolve alias import causes Rollup build error #1865

@JohnCido

Description

@JohnCido

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

If I import anything from resolved alias like this:

import xxx from '@lib/xxx'

When try to run build, it causes the following error:

[17:40:37]  ERROR  [vite]: Rollup failed to resolve import "@auth/xxx" from "xxx/src/ws.ts".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external

Expected behavior 🤔

It should respect the existing resolve alias setting without causing any error.

Steps to reproduce 🕹

Steps:

  1. Open this sandbox
  2. Run pnpm run build

Context 🔦

We have a very huge lib folder with many aliases. We need these to speed up the development and it's not a good practice for us to alter lib codes for Websocket use case.

Your environment 🌎

macOS or Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions