Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lvyjs/core
为 nodejs 开发而设计的打包构建工具
https://github.com/lvyjs/core
esbuild lvyjs nodejs puppeteer rollup tsx
Last synced: 20 days ago
JSON representation
为 nodejs 开发而设计的打包构建工具
- Host: GitHub
- URL: https://github.com/lvyjs/core
- Owner: lvyjs
- License: mit
- Created: 2024-10-16T10:44:52.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-10-24T05:51:55.000Z (23 days ago)
- Last Synced: 2024-10-26T02:46:23.666Z (21 days ago)
- Topics: esbuild, lvyjs, nodejs, puppeteer, rollup, tsx
- Language: TypeScript
- Homepage: https://lvyjs.dev
- Size: 247 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LVY
为 nodejs 开发而设计的打包构建工具
| Project | Status | Description |
| ------- | --------------------- | ----------- |
| [lvyjs] | [![lvyjs-s]][lvyjs-p] | 打包工具 |[lvyjs]: https://github.com/lemonade-lab/alemonjs/tree/main/packages/lvyjs
[lvyjs-s]: https://img.shields.io/npm/v/lvyjs.svg
[lvyjs-p]: https://www.npmjs.com/package/lvyjs- use
```sh
npm install lvyjs -D
```- tsconfig.json
```json
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@src/*": ["src/*"]
}
},
"include": ["src/**/*"],
"extends": "lvyjs/tsconfig.json"
}
```- lvy.config.ts
```ts
import { defineConfig } from 'lvyjs'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
export default defineConfig({
plugins: [
{
name: 'lvy-test-app',
useApp: () => import('./src/index')
}
],
build: {
alias: {
entries: [{ find: '@src', replacement: join(__dirname, 'src') }]
}
}
})
``````sh
npx lvy dev
```- 装载
> src/index.ts
```ts
import { readFileSync } from 'fs'
// 得到该文件的绝对路径,类型 string
import img_logo from '../logo.png'
const data = readFileSync(img_logo, 'utf-8')
```- 别名
> src/index.ts
```ts
import { readFileSync } from 'fs'
// 得到该文件的绝对路径,类型 string
import img_logo from '@src/asstes/img/logo.png'
const data = readFileSync(img_logo, 'utf-8')
```- 打包
> 对 src 目录打包并输出到 lib 目录
```sh
npx lvy build
```