Skip to content

Commit

Permalink
chore: update code
Browse files Browse the repository at this point in the history
  • Loading branch information
baran.wang committed Feb 15, 2024
1 parent 81aaa2e commit 832932b
Show file tree
Hide file tree
Showing 20 changed files with 142 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["homebridge-ui"]
"ignore": []
}
File renamed without changes.
46 changes: 46 additions & 0 deletions modern.config.ts
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,
},
],
});
Loading

0 comments on commit 832932b

Please sign in to comment.