Skip to content

Commit

Permalink
Merge pull request #18 from nix6839/hack-import
Browse files Browse the repository at this point in the history
fix: temporary fix cannot import vite in Yarn PnP
  • Loading branch information
KusStar authored Mar 14, 2024
2 parents f82dd69 + 1ed18f2 commit b42592b
Show file tree
Hide file tree
Showing 30 changed files with 2,796 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
push:
branches: ["main"]
pull_request:

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [18, 20]

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8.15.4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"

- run: corepack enable

- run: pnpm i --frozen-lockfile -P

- run: pnpm run test:demo
- run: pnpm run test:vite3
- run: pnpm run test:vite4
- run: pnpm run test:yarn-pnp
24 changes: 24 additions & 0 deletions fixtures/vite3/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
9 changes: 9 additions & 0 deletions fixtures/vite3/counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function setupCounter(element) {
let counter = 0
const setCounter = (count) => {
counter = count
element.innerHTML = `count is ${counter}`
}
element.addEventListener('click', () => setCounter(counter + 1))
setCounter(0)
}
13 changes: 13 additions & 0 deletions fixtures/vite3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/main.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions fixtures/vite3/javascript.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions fixtures/vite3/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import './style.css'
import javascriptLogo from './javascript.svg'
import { setupCounter } from './counter.js'

document.querySelector('#app').innerHTML = `
<div>
<a href="https://vitejs.dev" target="_blank">
<img src="/vite.svg" class="logo" alt="Vite logo" />
</a>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript" target="_blank">
<img src="${javascriptLogo}" class="logo vanilla" alt="JavaScript logo" />
</a>
<h1>Hello Vite!</h1>
<div class="card">
<button id="counter" type="button"></button>
</div>
<p class="read-the-docs">
Click on the Vite logo to learn more
</p>
</div>
`

setupCounter(document.querySelector('#counter'))
15 changes: 15 additions & 0 deletions fixtures/vite3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "vite3",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"devDependencies": {
"vite": "^3.2.3",
"vite-bundle-visualizer": "link:../.."
}
}
Loading

0 comments on commit b42592b

Please sign in to comment.