Skip to content

Commit

Permalink
feat: use loadModuleFromFramework load webpack in utils
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyuang committed Sep 9, 2024
1 parent a07b4a6 commit c9973b4
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/utils/src/server/webpack/common-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,15 @@ const addCommonChain = (chain: Chain, isServer: boolean) => {
chain.devtool(isServer ? (process.env.GENERATE_SOURCEMAP ? 'inline-source-map' : '') : process.env.GENERATE_SOURCEMAP ?? '' as any)
if (isDev && clientPrefix && !isServer) {
// for micro-app sourcemap
const webpack = require('ssr-webpack4')
chain.devtool(false)
chain.plugin('SourceMapDevToolPlugin').use(new webpack.SourceMapDevToolPlugin())
chain.plugin('BannerPlugin').use(new webpack.BannerPlugin({
const SourceMapDevToolPlugin = require(loadModuleFromFramework('ssr-webpack4')).SourceMapDevToolPlugin
const BannerPlugin = require(loadModuleFromFramework('ssr-webpack4')).BannerPlugin({
banner: () => '//# sourceURL=[file]',
raw: true,
include: /\.js$/
}))
})
chain.devtool(false)
chain.plugin('SourceMapDevToolPlugin').use(SourceMapDevToolPlugin)
chain.plugin('BannerPlugin').use(BannerPlugin)
}
const babelModule = chain.module
.rule('compileBabel')
Expand Down

0 comments on commit c9973b4

Please sign in to comment.