Skip to content

Commit

Permalink
fix: only add entry to client target
Browse files Browse the repository at this point in the history
  • Loading branch information
liximomo committed Aug 1, 2022
1 parent 310287e commit b2cbc96
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions packages/platform-web/src/node/features/html-render/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import {
createPlugin
} from '@shuvi/service';
import { IPlatformContext, ResolvedPlugin } from '@shuvi/service/lib/core';
import { BUNDLER_TARGET_SERVER } from '@shuvi/shared/lib/constants';
import {
BUNDLER_DEFAULT_TARGET,
BUNDLER_TARGET_SERVER
} from '@shuvi/shared/lib/constants';
import { webpackHelpers } from '@shuvi/toolpack/lib/webpack/config';
import { IWebpackEntry } from '@shuvi/service/lib/bundler/config';
import { resolvePkgFile } from '../../paths';
Expand Down Expand Up @@ -34,15 +37,17 @@ export const getPlugin = (
platformContext: IPlatformContext
): ResolvedPlugin => {
const core = createPlugin({
configWebpack: chain => {
chain.merge({
entry: {
[BUILD_CLIENT_RUNTIME_POLYFILL]: ['@shuvi/app/core/polyfill'],
[BUILD_CLIENT_RUNTIME_MAIN]: [
resolvePkgFile('esm/shuvi-app/entry/client')
]
}
});
configWebpack: (chain, { name }) => {
if (name === BUNDLER_DEFAULT_TARGET) {
chain.merge({
entry: {
[BUILD_CLIENT_RUNTIME_POLYFILL]: ['@shuvi/app/core/polyfill'],
[BUILD_CLIENT_RUNTIME_MAIN]: [
resolvePkgFile('esm/shuvi-app/entry/client')
]
}
});
}
return chain;
},
addExtraTarget: ({ createConfig }, context) => {
Expand Down

0 comments on commit b2cbc96

Please sign in to comment.