Coder Social home page Coder Social logo

vite-deno-example's Introduction

Vite + Deno

This is an example repo of running Vite with Deno.

You can see live site at: https://vite-deno-example.deno.dev

This repo is based on a deno-vue template from create-vite-extra:

$ deno run -A npm:create-vite-extra --template deno-vue

Notes

  • You need to use .mjs or .mts extension for the vite.config.[ext] file.

Papercuts

Currently there's a "papercut" for Deno users:

  • peer dependencies need to be referenced in vite.config.js - in this example it is only vue package that needs to be referenced

Running

You need to have Deno v1.28 or later intalled to run this repo.

Start a dev server:

$ deno task dev

Deploy

Build production assets:

$ deno task build

This repository uses Deno Deploy and Git integration, where deployment is happening as part of the CI pipeline.

vite-deno-example's People

Contributors

ayoubedd avatar bartlomieju avatar hashrock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

vite-deno-example's Issues

๐Ÿž Server proxy config got error!

App with backend api proxy got error.

//  vite.config.mts

export default defineConfig(({ mode }) => ({
  server: {
    proxy: {
      '/api': {
        target: 'http://xxx.xxx.xxx.xxx:8000/api,
        changeOrigin: true,
      }
    }
  }
}))

Error:

TypeError: Invalid URL: 'http://xxx.xxx.xxx.xxx:8000/api/auth/whoami'
    at getSerialization (ext:deno_url/00_url.js:89:11)
    at new URL (ext:deno_url/00_url.js:359:27)
    at new Request (ext:deno_fetch/23_request.js:300:25)
    at ext:deno_fetch/26_fetch.js:418:27
    at new Promise (<anonymous>)
    at fetch (ext:deno_fetch/26_fetch.js:414:18)
    at ClientRequest._final (ext:deno_node/http.ts:163:29)
    at Object.runMicrotasks (ext:core/01_core.js:830:30)

Error `deno task dev` (and others) commands when try to use `vite-extra` with react

Task dev deno run -A --unstable --node-modules-dir npm:vite
error: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'getReport')
    at isMusl (file:///home/t/deno_forge/_hft3/deno_ui/node_modules/.deno/[email protected]/node_modules/rollup/dist/native.js:5:30)
    at getPackageBase (file:///home/t/deno_forge/_hft3/deno_ui/node_modules/.deno/[email protected]/node_modules/rollup/dist/native.js:53:28)
    at Object.<anonymous> (file:///home/t/deno_forge/_hft3/deno_ui/node_modules/.deno/[email protected]/node_modules/rollup/dist/native.js:28:21)
    at Object.<anonymous> (file:///home/t/deno_forge/_hft3/deno_ui/node_modules/.deno/[email protected]/node_modules/rollup/dist/native.js:81:4)
    at Module._compile (node:module:733:34)
    at Object.Module._extensions..js (node:module:747:10)
    at Module.load (node:module:658:32)
    at Function.Module._load (node:module:539:12)
    at Module.require (node:module:677:19)
    at require (node:module:791:16)

Is it possible to fix this or may be I made something wrong (however I only run deno run -A npm:create-vite-extra@lates)?
Thanks)

[BUG] HMR not working

I had the issue with the vue package throwing errors, and solved it with the imports in deno.json as per another issue, thank you!

Now I can't get HMR working.

The HMR shows output in VSCode terminal of being updated, but the content in the browser doesn't change.

Any kind tip would be appreciated.

Remove --node-modules-dir flag?

What would need to change about Vite/Deno to make this setup work without the --node-modules-dir flag?


Thanks for putting this together, btw. Super helpful! ๐Ÿ‘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.