switch to vite
1
.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
node_modules
|
node_modules
|
||||||
packages/website/dist
|
packages/website/dist
|
||||||
packages/website/tools/.fusebox
|
|
||||||
packages/exporter/data/*
|
packages/exporter/data/*
|
||||||
!packages/exporter/data/output
|
!packages/exporter/data/output
|
||||||
packages/exporter/data/output/metadata.json
|
packages/exporter/data/output/metadata.json
|
||||||
|
3217
package-lock.json
generated
@ -6,8 +6,10 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start:website": "npm --workspace=@fbe/website run start",
|
"start:website": "npm --workspace=@fbe/website run start",
|
||||||
|
"preview:website": "npm --workspace=@fbe/website run preview",
|
||||||
"start:exporter": "cd ./packages/exporter && cargo run --release",
|
"start:exporter": "cd ./packages/exporter && cargo run --release",
|
||||||
"build:website": "npm --workspace=@fbe/website run build",
|
"build:website": "npm --workspace=@fbe/website run build",
|
||||||
|
"type-check": "tsc",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"lint:fix": "eslint . --fix",
|
"lint:fix": "eslint . --fix",
|
||||||
"format": "prettier . --check",
|
"format": "prettier . --check",
|
||||||
@ -17,7 +19,7 @@
|
|||||||
"@eslint/js": "^9.16.0",
|
"@eslint/js": "^9.16.0",
|
||||||
"eslint": "^9.16.0",
|
"eslint": "^9.16.0",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"typescript": "^4.5.4",
|
"typescript": "^5.7.2",
|
||||||
"typescript-eslint": "^8.17.0"
|
"typescript-eslint": "^8.17.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
},
|
},
|
||||||
"bugs": "https://github.com/Teoxoy/factorio-blueprint-editor/issues",
|
"bugs": "https://github.com/Teoxoy/factorio-blueprint-editor/issues",
|
||||||
"homepage": "https://github.com/Teoxoy/factorio-blueprint-editor",
|
"homepage": "https://github.com/Teoxoy/factorio-blueprint-editor",
|
||||||
|
"module": "./src/index.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pixi/basis": "^6.2.0",
|
"@pixi/basis": "^6.2.0",
|
||||||
"ajv": "^6.12.6",
|
"ajv": "^6.12.6",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as PIXI from 'pixi.js'
|
import * as PIXI from 'pixi.js'
|
||||||
import { BasisLoader } from '@pixi/basis'
|
import { BasisLoader } from '@pixi/basis'
|
||||||
import basisTranscoderJS from './basis/transcoder.1.16.4.js'
|
import basisTranscoderJS from './basis/transcoder.1.16.4.js?url'
|
||||||
import basisTranscoderWASM from './basis/transcoder.1.16.4.wasm'
|
import basisTranscoderWASM from './basis/transcoder.1.16.4.wasm?url'
|
||||||
import { loadData } from './core/factorioData'
|
import { loadData } from './core/factorioData'
|
||||||
import G from './common/globals'
|
import G from './common/globals'
|
||||||
import { Entity } from './core/Entity'
|
import { Entity } from './core/Entity'
|
||||||
@ -16,7 +16,7 @@ import { IllegalFlipError } from './containers/PaintContainer'
|
|||||||
export class Editor {
|
export class Editor {
|
||||||
public async init(canvas: HTMLCanvasElement, showError: (msg: string) => void): Promise<void> {
|
public async init(canvas: HTMLCanvasElement, showError: (msg: string) => void): Promise<void> {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fetch('__STATIC_URL__/data.json')
|
fetch('/data/data.json')
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.then(modules => loadData(modules)),
|
.then(modules => loadData(modules)),
|
||||||
BasisLoader.loadTranscoder(basisTranscoderJS, basisTranscoderWASM),
|
BasisLoader.loadTranscoder(basisTranscoderJS, basisTranscoderWASM),
|
||||||
|
@ -39,7 +39,7 @@ function getBT(path: string): Promise<PIXI.BaseTexture> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getTexture(path: string, x = 0, y = 0, w = 0, h = 0): PIXI.Texture {
|
function getTexture(path: string, x = 0, y = 0, w = 0, h = 0): PIXI.Texture {
|
||||||
const key = `__STATIC_URL__/${path.replace('.png', '.basis')}`
|
const key = `/data/${path.replace('.png', '.basis')}`
|
||||||
const KK = `${key}-${x}-${y}-${w}-${h}`
|
const KK = `${key}-${x}-${y}-${w}-${h}`
|
||||||
let t = textureCache.get(KK)
|
let t = textureCache.get(KK)
|
||||||
if (t) return t
|
if (t) return t
|
||||||
|
@ -21,7 +21,10 @@ import { PaintBlueprintContainer } from './PaintBlueprintContainer'
|
|||||||
import { OptimizedContainer } from './OptimizedContainer'
|
import { OptimizedContainer } from './OptimizedContainer'
|
||||||
import { GridData } from './GridData'
|
import { GridData } from './GridData'
|
||||||
|
|
||||||
export type GridPattern = 'checker' | 'grid'
|
export enum GridPattern {
|
||||||
|
CHECKER = 'checker',
|
||||||
|
GRID = 'grid',
|
||||||
|
}
|
||||||
|
|
||||||
export enum EditorMode {
|
export enum EditorMode {
|
||||||
/** Default */
|
/** Default */
|
||||||
|
@ -5,7 +5,6 @@ import { BlueprintContainer } from './BlueprintContainer'
|
|||||||
|
|
||||||
export class OptimizedContainer extends PIXI.Container {
|
export class OptimizedContainer extends PIXI.Container {
|
||||||
private bpc: BlueprintContainer
|
private bpc: BlueprintContainer
|
||||||
public children: EntitySprite[]
|
|
||||||
|
|
||||||
public constructor(bpc: BlueprintContainer) {
|
public constructor(bpc: BlueprintContainer) {
|
||||||
super()
|
super()
|
||||||
|
@ -8,7 +8,6 @@ import { BlueprintContainer } from './BlueprintContainer'
|
|||||||
export class PaintBlueprintContainer extends PaintContainer {
|
export class PaintBlueprintContainer extends PaintContainer {
|
||||||
private readonly bp: Blueprint
|
private readonly bp: Blueprint
|
||||||
private readonly entities = new Map<Entity, PaintBlueprintEntityContainer>()
|
private readonly entities = new Map<Entity, PaintBlueprintEntityContainer>()
|
||||||
public children: EntitySprite[]
|
|
||||||
|
|
||||||
public constructor(bpc: BlueprintContainer, entities: Entity[]) {
|
public constructor(bpc: BlueprintContainer, entities: Entity[]) {
|
||||||
super(bpc, 'blueprint')
|
super(bpc, 'blueprint')
|
||||||
|
@ -9,7 +9,7 @@ import { BlueprintContainer } from './BlueprintContainer'
|
|||||||
|
|
||||||
export class PaintWireContainer extends PaintContainer {
|
export class PaintWireContainer extends PaintContainer {
|
||||||
private color?: string
|
private color?: string
|
||||||
private cp?: IConnectionPoint? = undefined
|
private cp?: IConnectionPoint = undefined
|
||||||
/** This is only a reference */
|
/** This is only a reference */
|
||||||
private cursorBox: PIXI.Container
|
private cursorBox: PIXI.Container
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ function getBlueprintOrBookFromSource(source: string): Promise<Blueprint | Book>
|
|||||||
const pathParts = url.pathname.slice(1).split('/')
|
const pathParts = url.pathname.slice(1).split('/')
|
||||||
|
|
||||||
const fetchData = (url: string): Promise<Response> =>
|
const fetchData = (url: string): Promise<Response> =>
|
||||||
fetch(`__CORS_PROXY_URL__${encodeURIComponent(url)}`).then(response => {
|
fetch(`/corsproxy?url=${encodeURIComponent(url)}`).then(response => {
|
||||||
if (response.ok) return response
|
if (response.ok) return response
|
||||||
throw new Error('Network response was not ok.')
|
throw new Error('Network response was not ok.')
|
||||||
})
|
})
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2016",
|
"lib": ["ESNext", "DOM", "DOM.Iterable"]
|
||||||
"module": "CommonJS",
|
|
||||||
"lib": ["ES2019", "DOM", "DOM.Iterable"],
|
|
||||||
"esModuleInterop": true
|
|
||||||
},
|
},
|
||||||
"include": ["src/**/*.ts", "src/**/*.json"]
|
"include": ["src/**/*.ts", "src/**/*.json"]
|
||||||
}
|
}
|
||||||
|
@ -13,17 +13,16 @@
|
|||||||
|
|
||||||
<title>Factorio Blueprint Editor</title>
|
<title>Factorio Blueprint Editor</title>
|
||||||
|
|
||||||
<link rel="icon" href="$import('../assets/favicon.png')" />
|
<link rel="icon" href="/favicon.png" />
|
||||||
$css
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div id="loadingScreen" class="active">
|
<div id="loadingScreen" class="active">
|
||||||
<img id="logo" src="$import('../assets/logo.svg')" alt />
|
<img id="logo" src="/logo.svg" alt />
|
||||||
<img class="loadingWheel" src="$import('../assets/loadingWheel.svg')" alt />
|
<img class="loadingWheel" src="/loadingWheel.svg" alt />
|
||||||
</div>
|
</div>
|
||||||
<div id="corner-panel">
|
<div id="corner-panel">
|
||||||
<img src="$import('../assets/logo-small.svg')" alt />
|
<img src="/logo-small.svg" alt />
|
||||||
<span>Press I for info</span>
|
<span>Press I for info</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="buttons">
|
<div id="buttons">
|
||||||
@ -34,7 +33,7 @@
|
|||||||
rel="noopener"
|
rel="noopener"
|
||||||
>
|
>
|
||||||
<span>Discord</span>
|
<span>Discord</span>
|
||||||
<img src="$import('../assets/discord.svg')" alt />
|
<img src="/discord.svg" alt />
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
class="github-button"
|
class="github-button"
|
||||||
@ -43,7 +42,7 @@
|
|||||||
rel="noopener"
|
rel="noopener"
|
||||||
>
|
>
|
||||||
<span>Github</span>
|
<span>Github</span>
|
||||||
<img src="$import('../assets/github.svg')" alt />
|
<img src="/github.svg" alt />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div id="info-panel">
|
<div id="info-panel">
|
||||||
@ -93,6 +92,6 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<canvas id="editor" tabindex="1"></canvas>
|
<canvas id="editor" tabindex="1"></canvas>
|
||||||
$bundles
|
<script type="module" src="/src/index.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -3,8 +3,9 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "ts-node -T tools/fuse dev",
|
"start": "vite",
|
||||||
"build": "ts-node -T tools/fuse build"
|
"build": "vite build",
|
||||||
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fbe/editor": "*",
|
"@fbe/editor": "*",
|
||||||
@ -15,10 +16,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/dat.gui": "^0.7.7",
|
"@types/dat.gui": "^0.7.7",
|
||||||
"@types/file-saver": "^2.0.4",
|
"@types/file-saver": "^2.0.4",
|
||||||
"@types/node": "^14.18.0",
|
"stylus": "^0.64.0",
|
||||||
"fuse-box": "^4.0.1-next.8",
|
"vite": "^6.0.3",
|
||||||
"stylus": "^0.55.0",
|
"vite-plugin-static-copy": "^2.2.0"
|
||||||
"ts-node": "^10.4.0",
|
|
||||||
"typescript": "^4.5.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 851 B After Width: | Height: | Size: 851 B |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 866 B |
Before Width: | Height: | Size: 487 KiB After Width: | Height: | Size: 487 KiB |
@ -6,8 +6,8 @@
|
|||||||
font-style: normal
|
font-style: normal
|
||||||
font-weight: 300
|
font-weight: 300
|
||||||
src: local('Roboto Light'), local('Roboto-Light'),
|
src: local('Roboto Light'), local('Roboto-Light'),
|
||||||
url('./../assets/fonts/roboto-v20-latin/300.woff2') format('woff2'),
|
url('/fonts/roboto-v20-latin/300.woff2') format('woff2'),
|
||||||
url('./../assets/fonts/roboto-v20-latin/300.woff') format('woff')
|
url('/fonts/roboto-v20-latin/300.woff') format('woff')
|
||||||
|
|
||||||
// roboto-400 - latin
|
// roboto-400 - latin
|
||||||
@font-face
|
@font-face
|
||||||
@ -15,8 +15,8 @@
|
|||||||
font-style: normal
|
font-style: normal
|
||||||
font-weight: 400
|
font-weight: 400
|
||||||
src: local('Roboto'), local('Roboto-Regular'),
|
src: local('Roboto'), local('Roboto-Regular'),
|
||||||
url('./../assets/fonts/roboto-v20-latin/400.woff2') format('woff2'),
|
url('/fonts/roboto-v20-latin/400.woff2') format('woff2'),
|
||||||
url('./../assets/fonts/roboto-v20-latin/400.woff') format('woff')
|
url('/fonts/roboto-v20-latin/400.woff') format('woff')
|
||||||
|
|
||||||
// roboto-500 - latin
|
// roboto-500 - latin
|
||||||
@font-face
|
@font-face
|
||||||
@ -24,8 +24,8 @@
|
|||||||
font-style: normal
|
font-style: normal
|
||||||
font-weight: 500
|
font-weight: 500
|
||||||
src: local('Roboto Medium'), local('Roboto-Medium'),
|
src: local('Roboto Medium'), local('Roboto-Medium'),
|
||||||
url('./../assets/fonts/roboto-v20-latin/500.woff2') format('woff2'),
|
url('/fonts/roboto-v20-latin/500.woff2') format('woff2'),
|
||||||
url('./../assets/fonts/roboto-v20-latin/500.woff') format('woff')
|
url('/fonts/roboto-v20-latin/500.woff') format('woff')
|
||||||
|
|
||||||
// titillium-web-400 - latin
|
// titillium-web-400 - latin
|
||||||
@font-face
|
@font-face
|
||||||
@ -33,8 +33,8 @@
|
|||||||
font-style: normal
|
font-style: normal
|
||||||
font-weight: 400
|
font-weight: 400
|
||||||
src: local('Titillium Web Regular'), local('TitilliumWeb-Regular'),
|
src: local('Titillium Web Regular'), local('TitilliumWeb-Regular'),
|
||||||
url('./../assets/fonts/titillium-web-v8-latin/400.woff2') format('woff2'),
|
url('/fonts/titillium-web-v8-latin/400.woff2') format('woff2'),
|
||||||
url('./../assets/fonts/titillium-web-v8-latin/400.woff') format('woff')
|
url('/fonts/titillium-web-v8-latin/400.woff') format('woff')
|
||||||
|
|
||||||
|
|
||||||
// Normalize
|
// Normalize
|
||||||
@ -128,6 +128,7 @@ html
|
|||||||
|
|
||||||
#editor
|
#editor
|
||||||
position: fixed
|
position: fixed
|
||||||
|
outline: none
|
||||||
|
|
||||||
#doorbell
|
#doorbell
|
||||||
&-submit-button
|
&-submit-button
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
import { join } from 'path'
|
|
||||||
import { fusebox, sparky, pluginLink, pluginReplace } from 'fuse-box'
|
|
||||||
import { IDevServerProps } from 'fuse-box/devServer/devServerProps'
|
|
||||||
import { IPublicConfig } from 'fuse-box/config/IConfig'
|
|
||||||
import { IRunResponse } from 'fuse-box/core/IRunResponse'
|
|
||||||
import { IRunProps } from 'fuse-box/config/IRunProps'
|
|
||||||
|
|
||||||
const port = Number(process.env.PORT) || 8080
|
|
||||||
|
|
||||||
const p = (p: string): string => join(__dirname, p)
|
|
||||||
|
|
||||||
const HEADERS_FILE = p('../src/_headers')
|
|
||||||
const EXPORTER_DATA = p('../../exporter/data/output')
|
|
||||||
|
|
||||||
class Context {
|
|
||||||
public readonly paths = {
|
|
||||||
dist: p('../dist'),
|
|
||||||
}
|
|
||||||
public runDev(runProps?: IRunProps): Promise<IRunResponse> {
|
|
||||||
return fusebox(this.getConfig(true)).runDev(runProps)
|
|
||||||
}
|
|
||||||
public runProd(runProps?: IRunProps): Promise<IRunResponse> {
|
|
||||||
return fusebox(this.getConfig()).runProd(runProps)
|
|
||||||
}
|
|
||||||
private getConfig(runServer = false): IPublicConfig {
|
|
||||||
return {
|
|
||||||
compilerOptions: {
|
|
||||||
tsConfig: p('../tsconfig.json'),
|
|
||||||
},
|
|
||||||
entry: p('../src/index.ts'),
|
|
||||||
target: 'browser',
|
|
||||||
webIndex: { template: p('../src/index.html') },
|
|
||||||
devServer: runServer && this.getServerConfig(),
|
|
||||||
resources: {
|
|
||||||
resourcePublicRoot: '/assets',
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
pluginLink(/transcoder\.(.+?)\.(js|wasm)$/, { useDefault: true }),
|
|
||||||
pluginReplace({
|
|
||||||
__CORS_PROXY_URL__: runServer
|
|
||||||
? 'https://api.allorigins.win/raw?url='
|
|
||||||
: '/corsproxy?url=',
|
|
||||||
__STATIC_URL__: '/data',
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
cache: { enabled: runServer, strategy: 'memory' },
|
|
||||||
hmr: { plugin: p('./hmr.ts') },
|
|
||||||
sourceMap: {
|
|
||||||
css: !runServer,
|
|
||||||
project: true,
|
|
||||||
vendor: false,
|
|
||||||
},
|
|
||||||
watcher: {
|
|
||||||
root: [p('../src'), p('../../editor/src')],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private getServerConfig(): IDevServerProps {
|
|
||||||
return {
|
|
||||||
httpServer: { port },
|
|
||||||
hmrServer: { port },
|
|
||||||
proxy: [
|
|
||||||
{
|
|
||||||
path: '/data',
|
|
||||||
options: {
|
|
||||||
target: `http://127.0.0.1:8081`,
|
|
||||||
pathRewrite: { '^/data': '' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const { src, rm, task } = sparky(Context)
|
|
||||||
|
|
||||||
task('dev', async ctx => {
|
|
||||||
rm(ctx.paths.dist)
|
|
||||||
await ctx.runDev({
|
|
||||||
bundles: { distRoot: ctx.paths.dist },
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
task('build', async ctx => {
|
|
||||||
rm(ctx.paths.dist)
|
|
||||||
await ctx.runProd({
|
|
||||||
bundles: {
|
|
||||||
distRoot: ctx.paths.dist,
|
|
||||||
app: 'js/app.$hash.js',
|
|
||||||
vendor: 'js/vendor.$hash.js',
|
|
||||||
styles: 'css/styles.$hash.css',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
await src(HEADERS_FILE).dest(ctx.paths.dist, 'src/').exec()
|
|
||||||
|
|
||||||
await src(`${EXPORTER_DATA}/**/**.*`).dest(`${ctx.paths.dist}/data`, 'output/').exec()
|
|
||||||
})
|
|
@ -1,20 +0,0 @@
|
|||||||
// import { HMRHelper, HMRPayload } from 'fuse-box/types/hmr'
|
|
||||||
|
|
||||||
// export default function (payload: HMRPayload, helper: HMRHelper): void {
|
|
||||||
// const { updates } = payload
|
|
||||||
// console.log('__HMR__', payload, helper)
|
|
||||||
// if (helper.isStylesheeetUpdate) {
|
|
||||||
// helper.flushModules(updates)
|
|
||||||
// helper.updateModules()
|
|
||||||
// helper.callModules(updates)
|
|
||||||
// } else {
|
|
||||||
// helper.flushAll()
|
|
||||||
// helper.updateModules()
|
|
||||||
// helper.callEntries()
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
export default function (): void {
|
|
||||||
// @ts-ignore
|
|
||||||
window.location.reload()
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "../../../tsconfig.json",
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ES2016",
|
|
||||||
"module": "CommonJS",
|
|
||||||
"lib": ["ES2016"],
|
|
||||||
"esModuleInterop": true
|
|
||||||
},
|
|
||||||
"include": ["*.ts"]
|
|
||||||
}
|
|
@ -1,10 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "ES2016",
|
"lib": ["ESNext", "DOM"],
|
||||||
"module": "CommonJS",
|
"types": ["vite/client"]
|
||||||
"lib": ["ES2016", "DOM"],
|
|
||||||
"esModuleInterop": true
|
|
||||||
},
|
},
|
||||||
"include": ["src"]
|
"include": ["src", "../editor/src/global.d.ts"]
|
||||||
}
|
}
|
||||||
|
45
packages/website/vite.config.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import { defineConfig } from 'vite'
|
||||||
|
import { viteStaticCopy } from 'vite-plugin-static-copy'
|
||||||
|
|
||||||
|
const fullReloadAlways = {
|
||||||
|
name: 'full-reload',
|
||||||
|
handleHotUpdate({ server }) {
|
||||||
|
server.ws.send({ type: 'full-reload' })
|
||||||
|
return []
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineConfig(({ command, mode }) => {
|
||||||
|
const proxy = {
|
||||||
|
'/corsproxy': {
|
||||||
|
target: 'https://fbe.teoxoy.com',
|
||||||
|
changeOrigin: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if (mode !== 'production') {
|
||||||
|
proxy['/data'] = {
|
||||||
|
target: 'http://127.0.0.1:8081',
|
||||||
|
rewrite: path => path.replace(/^\/data/, ''),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
build: { sourcemap: true },
|
||||||
|
preview: { port: 8080 },
|
||||||
|
server: {
|
||||||
|
port: 8080,
|
||||||
|
proxy,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
command === 'build'
|
||||||
|
? viteStaticCopy({
|
||||||
|
targets: [
|
||||||
|
{
|
||||||
|
src: '../exporter/data/output/*',
|
||||||
|
dest: 'data',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
: fullReloadAlways,
|
||||||
|
],
|
||||||
|
}
|
||||||
|
})
|
@ -1,19 +1,22 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"pretty": true,
|
"target": "ESNext",
|
||||||
"sourceMap": true,
|
"module": "ES6",
|
||||||
"alwaysStrict": true,
|
"skipLibCheck": true,
|
||||||
"removeComments": true,
|
|
||||||
"noImplicitAny": true,
|
/* Bundler mode */
|
||||||
"noUnusedLocals": true,
|
"moduleResolution": "bundler",
|
||||||
"noUnusedParameters": true,
|
"allowImportingTsExtensions": true,
|
||||||
"preserveConstEnums": true,
|
"isolatedModules": true,
|
||||||
|
"moduleDetection": "force",
|
||||||
|
"noEmit": true,
|
||||||
|
|
||||||
|
// "strict": true, // TODO: enable
|
||||||
|
|
||||||
"rootDir": ".",
|
"rootDir": ".",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
"@fbe/*": ["packages/*/src/index.ts"],
|
"@fbe/*": ["packages/*/src/index.ts"]
|
||||||
"mini-signals": ["node_modules/resource-loader/typings/mini-signals.d.ts"]
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"typeRoots": ["./node_modules/@types"]
|
"typeRoots": ["./node_modules/@types"]
|
||||||
|