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

docs: Deploying a Static Site npm command instructions inconsistent with template package.json #4609

Closed
7 tasks done
theoriginalstove opened this issue Aug 15, 2021 · 1 comment · Fixed by #4610
Closed
7 tasks done
Labels
documentation Improvements or additions to documentation

Comments

@theoriginalstove
Copy link
Contributor

Describe the bug

Going through the documentation to Deploy a Static Site the npm commands listed to see a preview of the built project are inconsistent with what the template package.json that's placed in the root directory of the project.

I went through the the templates for vue, react, preact, and vanilla and their respective Typescript counterparts. The templates all have the scripts command serve instead of the documented preview command.

Potential options:

  1. Update the documentation to reflect the template package.json file commands serve to run vite preview.
  2. Update the templates to include both serve and preview to run vite preview. Either issuing a deprecation warning when running npm run serve or making note of the breaking change in the next 2.x release.

Original discussion from Discord

Reproduction

Creating a new project using the documentation:

npm init vite@latest --template <vue | vue-ts | vanilla | vanilla-ts | react | react-ts | preact | preact-ts> test-project
cd ./test-project
npm install
npm run build
npm run preview

System Info

System:
    OS: Linux 5.13 Fedora 34 (Workstation Edition) 34 (Workstation Edition)
    CPU: (20) x64 Intel(R) Core(TM) i9-10900KF CPU @ 3.70GHz
    Memory: 7.23 GB / 31.26 GB
    Container: Yes
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
    Yarn: 1.22.10 - /usr/bin/yarn
    npm: 6.14.14 - ~/.nvm/versions/node/v14.17.5/bin/npm
  Browsers:
    Firefox: 90.0.2
  npmPackages:
    @vitejs/plugin-vue: ^1.3.0 => 1.4.0
    vite: ^2.4.4 => 2.4.4

Used Package Manager

npm

Logs

npm run preview
npm ERR! missing script: preview

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/theoriginalstove/.npm/_logs/2021-08-15T05_57_12_414Z-debug.log

Validations

@theoriginalstove
Copy link
Contributor Author

It's not a good idea to change the package.json scripts to add preview as that seems to cause issues with npm.
For more info on why using preview would be a bad idea for npm run preview instead of running npm run serve see the npm docs for pre and post scripts

@theoriginalstove theoriginalstove changed the title Deploying a Static Site npm command instructions inconsistent with template package.json docs: Deploying a Static Site npm command instructions inconsistent with template package.json Aug 15, 2021
@Shinigami92 Shinigami92 added documentation Improvements or additions to documentation and removed pending triage labels Aug 15, 2021
@Shinigami92 Shinigami92 linked a pull request Aug 15, 2021 that will close this issue
9 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2021
aleclarson pushed a commit to aleclarson/vite that referenced this issue Nov 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants