generated from homebridge/homebridge-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
baran.wang
committed
Feb 15, 2024
1 parent
81aaa2e
commit 832932b
Showing
20 changed files
with
142 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { moduleTools, defineConfig } from '@modern-js/module-tools'; | ||
import path from 'path'; | ||
|
||
const baseOutDir = path.resolve(__dirname, './homebridge-ui'); | ||
|
||
export default defineConfig({ | ||
plugins: [moduleTools()], | ||
buildConfig: [ | ||
{ | ||
buildType: 'bundle', | ||
input: ['ui-src/server.ts'], | ||
outDir: baseOutDir, | ||
tsconfig: 'tsconfig.ui.json', | ||
externals: ['@homebridge/plugin-ui-utils', '@api/index'], | ||
dts: false, | ||
hooks: [ | ||
{ | ||
name: 'renderChunk', | ||
apply(compiler) { | ||
compiler.hooks.renderChunk.tapPromise('renderChunk', async (chunk) => { | ||
if (chunk.type === 'chunk') { | ||
chunk.contents = chunk.contents.replace(/@api\/index/g, '../dist/api'); | ||
} | ||
return chunk; | ||
}); | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
buildType: 'bundle', | ||
input: ['ui-src/index.tsx'], | ||
outDir: path.resolve(baseOutDir, 'public'), | ||
autoExternal: false, | ||
platform: 'browser', | ||
tsconfig: 'tsconfig.ui.json', | ||
copy: { | ||
patterns: [{ from: './index.html', context: __dirname }], | ||
}, | ||
define: { | ||
'process.env.NODE_ENV': process.env.NODE_ENV ?? 'development', | ||
}, | ||
dts: false, | ||
}, | ||
], | ||
}); |
Oops, something went wrong.