add package aliases
This commit is contained in:
parent
0b7616fd38
commit
70cfee24b0
|
|
@ -13,7 +13,13 @@
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"noUnusedLocals": false,
|
"noUnusedLocals": false,
|
||||||
"lib": ["DOM", "DOM.Iterable", "ESNext", "WebWorker"],
|
"lib": ["DOM", "DOM.Iterable", "ESNext", "WebWorker"],
|
||||||
"types": ["@webgpu/types", "@types/node", "bun-types"]
|
"types": ["@webgpu/types", "@types/node", "bun-types"],
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@lib/*": ["lib/*"],
|
||||||
|
"@labs/*": ["labs/*"],
|
||||||
|
"@propagators/*": ["propagators/*"]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"include": ["lib/**/*.ts", "website/**/*.ts", "vite.config.ts"]
|
"include": ["lib/**/*.ts", "website/**/*.ts", "vite.config.ts"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import { resolve } from 'node:path';
|
||||||
import { readdirSync } from 'node:fs';
|
import { readdirSync } from 'node:fs';
|
||||||
import { defineConfig, IndexHtmlTransformContext, Plugin } from 'vite';
|
import { defineConfig, IndexHtmlTransformContext, Plugin } from 'vite';
|
||||||
|
|
||||||
const canvasWebsiteDir = resolve(__dirname, 'website/canvas');
|
const canvasWebsiteDir = resolve(__dirname, './website/canvas');
|
||||||
|
|
||||||
function getCanvasFiles() {
|
function getCanvasFiles() {
|
||||||
return readdirSync(canvasWebsiteDir).filter((file) => file.endsWith('.html'));
|
return readdirSync(canvasWebsiteDir).filter((file) => file.endsWith('.html'));
|
||||||
|
|
@ -65,12 +65,19 @@ const linkGenerator = (): Plugin => {
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
root: 'website',
|
root: 'website',
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@lib': resolve(__dirname, './lib'),
|
||||||
|
'@labs': resolve(__dirname, './labs'),
|
||||||
|
'@propagators': resolve(__dirname, './labs'),
|
||||||
|
},
|
||||||
|
},
|
||||||
plugins: [linkGenerator()],
|
plugins: [linkGenerator()],
|
||||||
build: {
|
build: {
|
||||||
target: 'esnext',
|
target: 'esnext',
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: {
|
input: {
|
||||||
index: resolve(__dirname, 'website/index.html'),
|
index: resolve(__dirname, './website/index.html'),
|
||||||
...getCanvasFiles().reduce((acc, file) => {
|
...getCanvasFiles().reduce((acc, file) => {
|
||||||
acc[`canvas/${file.replace('.html', '')}`] = resolve(canvasWebsiteDir, file);
|
acc[`canvas/${file.replace('.html', '')}`] = resolve(canvasWebsiteDir, file);
|
||||||
return acc;
|
return acc;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { FolkElement } from '../../../lib/common/folk-element';
|
import { FolkElement } from '@lib/common/folk-element';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { FolkElement } from '../../../lib/common/folk-element';
|
import { FolkElement } from '@lib/common/folk-element';
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface HTMLElementTagNameMap {
|
interface HTMLElementTagNameMap {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { html } from '../../../lib/common/tags';
|
import { html } from '@lib/common/tags';
|
||||||
|
|
||||||
interface Weather {
|
interface Weather {
|
||||||
temperature: string;
|
temperature: string;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
// Ported from https://github.com/bitu467/record-player
|
// Ported from https://github.com/bitu467/record-player
|
||||||
import { css, html } from '../../../lib/common/tags';
|
import { css, html } from '@lib/common/tags';
|
||||||
|
|
||||||
const styles = css`
|
const styles = css`
|
||||||
::slotted(*) {
|
::slotted(*) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue