Skip to content

Commit

Permalink
Add support for additional client entries
Browse files Browse the repository at this point in the history
Useful for if you have routes which render something different than the main entry point. Essentially allowing supporting different apps on different routes
  • Loading branch information
JakeGinnivan committed Jan 8, 2020
1 parent 7517d81 commit 7551d9c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ build-stats.csv
*.tgz
test-dist

tsconfig.tsbuildinfo
*.tsbuildinfo

#cache-loader & validation inside this folder
.build-cache
1 change: 1 addition & 0 deletions examples/simple-ssr/client/extra.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('extra entry!')
3 changes: 3 additions & 0 deletions examples/simple-ssr/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
module.exports = {
default: {
TS_CONFIG_SERVER: 'examples/simple-ssr/tsconfig.server.json',
ADDITIONAL_CIENT_ENTRIES: {
additional: 'examples/simple-ssr/client/extra.tsx',
},
},
}
4 changes: 4 additions & 0 deletions lib/config/webpack.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const clientBaseConfig: CreateWebpackConfig = options => {
main: mainEntry,
}

if (options.buildConfig.ADDITIONAL_CIENT_ENTRIES) {
Object.assign(entry, options.buildConfig.ADDITIONAL_CIENT_ENTRIES)
}

const plugins = getPlugins(options.buildConfig)
const resolvePlugins: webpack.ResolvePlugin[] = []

Expand Down
4 changes: 4 additions & 0 deletions lib/runtime/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export interface BuildConfig {
/** entry file for the client */
CLIENT_ENTRY: string

ADDITIONAL_CIENT_ENTRIES?: {
[name: string]: string[]
}

/** file for client polyfills if needed */
CLIENT_POLYFILLS: string | false

Expand Down

0 comments on commit 7551d9c

Please sign in to comment.