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

Fresh lit+ts project does not build full dist #12431

Closed
7 tasks done
Zoramite opened this issue Mar 15, 2023 · 5 comments
Closed
7 tasks done

Fresh lit+ts project does not build full dist #12431

Zoramite opened this issue Mar 15, 2023 · 5 comments
Labels
duplicate This issue or pull request already exists feat: library mode

Comments

@Zoramite
Copy link

Describe the bug

When trying to use the boiler plate lit project the production build does not correctly export the files for serving.

After visiting in the browser I get a 404 error: Cannot GET /. I think that this is because there is not index.html generated in the dist? The dist only has two files: vite-project.js vite.svg.

Reproduction

https://stackblitz.com/edit/vitejs-vite-dkycbq?file=index.html

Steps to reproduce

npm create vite@latest
# Choose lit + typescript options
cd vite-project
npm install
npm run build
npx vite preview

System Info

System:
    OS: macOS 13.2.1
    CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
    Memory: 30.54 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.0 - ~/.nvm/versions/node/v16.14.0/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v16.14.0/bin/yarn
    npm: 8.4.1 - ~/.nvm/versions/node/v16.14.0/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
    Chrome Canary: 113.0.5653.0
    Safari: 16.3
  npmPackages:
    vite: ^4.1.0 => 4.1.4

Used Package Manager

npm

Logs

➜  vite-project npm run build

> [email protected] build
> tsc && vite build

nvite v4.1.4 building for production...
✓ 2 modules transformed.
dist/vite-project.js  3.44 kB │ gzip: 1.72 kB
m%                                                                                                 
➜  vite-project npx vite preview
  ➜  Local:   http://127.0.0.1:4173/
  ➜  Network: use --host to expose

Validations

@stackblitz
Copy link

stackblitz bot commented Mar 15, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@Zoramite Zoramite changed the title Fresh lit+ts project does not usable build Fresh lit+ts project does not serve usable build Mar 15, 2023
@Zoramite Zoramite changed the title Fresh lit+ts project does not serve usable build Fresh lit+ts project does not build full dist Mar 15, 2023
@fi3ework
Copy link
Member

fi3ework commented Mar 15, 2023

Duplicate of #7009

@fi3ework fi3ework marked this as a duplicate of #7009 Mar 15, 2023
@fi3ework
Copy link
Member

It's because lit and lit-ts are library target configs instead of app target configs like others (react / vue). I've no idea why lit's templates are set to lib 🤔. It seems to be library target from the very beginning. 830f3d3
So no preview mode for lib mode.

But should we change lit & lit-ts to app target(seems like a breaking change) or document it in the CLI? For example Lit(library)

@fi3ework fi3ework added duplicate This issue or pull request already exists feat: library mode and removed pending triage labels Mar 15, 2023
@kushal
Copy link

kushal commented Mar 15, 2023

I was recently confused by this, strong vote to fix!

@fi3ework
Copy link
Member

resolved in #12459. create-vite will create Lit applications as of @4.3.0

@github-actions github-actions bot locked and limited conversation to collaborators Apr 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists feat: library mode
Projects
None yet
Development

No branches or pull requests

3 participants