Skip to content

Commit d230a22

Browse files
committed
refactor: remove unnecessary host entry
1 parent f6f5f2b commit d230a22

File tree

5 files changed

+125
-258
lines changed

5 files changed

+125
-258
lines changed

examples/host/nut.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module.exports = {
2-
type: 'host',
32
layout: 'now',
43
zh: 'nut compose',
54
router: {

packages/driver-pages/lib/webpack/extend-webpack.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,10 @@ const StatsWriterPlugin = require( 'webpack-stats-plugin' ).StatsWriterPlugin
88
const dirs = require( '../utils/dirs' )
99

1010
exports.normal = function ( config, nutConfig ) {
11-
if ( nutConfig.type === 'host' ) {
12-
config
13-
.entry( 'index' )
14-
.add( path.join( dirs.runtime, 'entries/host.js' ) )
15-
.end()
16-
} else {
17-
config
18-
.entry( 'index' )
19-
.add( path.join( dirs.runtime, 'entries/single.js' ) )
20-
.end()
21-
}
11+
config
12+
.entry( 'index' )
13+
.add( path.join( dirs.runtime, 'entries/default.js' ) )
14+
.end()
2215

2316
let templatePath
2417

packages/runtime-pages/src/entries/single.js renamed to packages/runtime-pages/src/entries/default.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import routes from '@/nut-auto-generated-routes'
1515
import pluginOptions from '@/nut-auto-generated-plugin-options'
1616
import config from '@/nut-auto-generated-config'
1717

18+
import applyCompose from '../steps/apply-compose'
1819
import applyPlugins from '../steps/apply-plugins'
1920
import setupNico from '../steps/setup-nico'
2021
import registerLayouts from '../steps/register-layouts'
@@ -31,6 +32,12 @@ import events from '../context/events'
3132
import use from '../context/use'
3233

3334
;( async function () {
35+
if ( nutConfig.compose ) {
36+
const composed = await applyCompose( nutConfig.compose )
37+
pages.push( ...composed.pages )
38+
routes.push( ...composed.routes )
39+
}
40+
3441
const routerOptions = nutConfig.router || {}
3542
const router = createRouter( routerOptions )
3643

packages/runtime-pages/src/entries/host.js

Lines changed: 0 additions & 246 deletions
This file was deleted.

0 commit comments

Comments
 (0)