Commit 315356ca authored by Michael Underwood's avatar Michael Underwood
Browse files

Migrate from Rollup to Vite

parent d675fabd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -89,12 +89,12 @@ export default {
### Component playground

To see the [component playground](https://github.com/vue-leaflet/vue-leaflet/tree/master/src/playground/views) in action,
clone this repo and run the local devserver, then visit localhost:8080,
clone this repo and run the local devserver, then visit http://127.0.0.1:5173,
```bash
git clone https://github.com/vue-leaflet/vue-leaflet.git
cd vue-leaflet
yarn
yarn serve
yarn dev
```

### Server-side rendering (SSR)

index.html

0 → 100644
+12 −0
Original line number Diff line number Diff line
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>vue-leaflet playground</title>
</head>
<body>
  <div id="app"></div>
  <script type="module" src="/src/playground/index.js"></script>
</body>
</html>
 No newline at end of file
+7 −12
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
  "sideEffects": false,
  "main": "dist/vue-leaflet.cjs.js",
  "unpkg": "dist/vue-leaflet.umd.js",
  "module": "dist/vue-leaflet.esm.js",
  "module": "dist/vue-leaflet.es.js",
  "files": [
    "dist/",
    "src/"
@@ -17,9 +17,9 @@
    "url": "git@github.com:vue-leaflet/vue-leaflet.git"
  },
  "scripts": {
    "serve": "vue-cli-service serve ./src/playground/index.js",
    "build": "rollup -c rollup.config.js",
    "lint": "vue-cli-service lint",
    "dev": "vite",
    "build": "vite build",
    "lint": "eslint --ext .js,.vue --ignore-path .gitignore --fix src",
    "prepublishOnly": "npm run lint && npm run build",
    "postversion": "git push --follow-tags",
    "docs:dev": "vitepress dev docs",
@@ -31,10 +31,7 @@
  },
  "devDependencies": {
    "@types/leaflet": "^1.5.7",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vitejs/plugin-vue": "^4.0.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-config-prettier": "^6.11.0",
@@ -44,11 +41,9 @@
    "leaflet": "^1.6.0",
    "lint-staged": "^10.4.0",
    "prettier": "^2.0.5",
    "rollup": "^2.8.0",
    "rollup-plugin-commonjs": "^10.1.0",
    "rollup-plugin-vue": "^6.0.0-beta.11",
    "vite": "^4.1.1",
    "vitepress": "^0.6.0",
    "vue": "^3.0.0",
    "vue": "^3.2.25",
    "vue-router": "^4.0.0-rc.5"
  },
  "husky": {

vite.config.js

0 → 100644
+31 −0
Original line number Diff line number Diff line
const path = require("path");
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
    },
  },
  build: {
    lib: {
      entry: path.resolve(__dirname, "src/lib.js"),
      formats: ["es", "cjs", "umd"],
      name: "vue-leaflet",
      fileName: (fmt) => `vue-leaflet.${fmt}.js`,
    },
    rollupOptions: {
      external: ["vue", "leaflet", /^leaflet\/.*/],
      output: {
        // Global variables for use in the UMD build
        globals: {
          vue: "Vue",
          leaflet: "L",
        },
      },
    },
  },
});
+419 −6698

File changed.

Preview size limit exceeded, changes collapsed.