Skip to content

Commit

Permalink
Merge pull request #1700 from SUI-Components/feat/add-cache-version-link
Browse files Browse the repository at this point in the history
Feat/add cache version link
  • Loading branch information
andresz1 authored Jan 11, 2024
2 parents fc06e8d + d4d499b commit 015c937
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion packages/sui-bundler/bin/sui-bundler-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,17 @@ const start = async ({config = webpackConfig, packagesToLink = program.opts().li
const protocol = HTTPS === 'true' ? 'https' : 'http'
const port = await choosePort(DEFAULT_PORT)
const urls = prepareUrls(protocol, HOST, port)

const {linkAll} = program.opts()

const configVars = JSON.stringify({packagesToLink, linkAll})
const version = `${__dirname}|${configVars}`
const nextConfig = linkLoaderConfigBuilder({
config,
linkAll: program.opts().linkAll,
linkAll,
packagesToLink
})
nextConfig.cache.version = version

const compiler = createCompiler(nextConfig, urls)
const serverConfig = createDevServerConfig(nextConfig, urls.lanUrlForConfig)
Expand Down
11 changes: 9 additions & 2 deletions packages/sui-ssr/bin/sui-ssr-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ const start = async ({packagesToLink, linkAll}) => {
process.env.CDN = cdn
process.env.DEV_SERVER = 'true'

const configVars = JSON.stringify({packagesToLink, linkAll})
const clientConfig = require('@s-ui/bundler/webpack.config.client.dev.js')
const serverConfig = serverConfigFactory({outputPath: SERVER_OUTPUT_PATH})

const version = `${__dirname}|${configVars}`

clientConfig.cache.version = version
serverConfig.cache.version = version

const clientCompiler = webpack(
linkLoaderConfigBuilder({
Expand All @@ -93,7 +100,7 @@ const start = async ({packagesToLink, linkAll}) => {

const serverCompiler = webpack(
linkLoaderConfigBuilder({
config: serverConfigFactory({outputPath: SERVER_OUTPUT_PATH}),
config: serverConfig,
linkAll,
packagesToLink
})
Expand Down Expand Up @@ -170,7 +177,7 @@ const start = async ({packagesToLink, linkAll}) => {
const msg = time > 2000 ? `${Math.round(time / 100) / 10}s` : `${time}ms`

clearConsole()
log.success(`✓ Compiled successfully in ${msg}\n`)
log.success(`✓ Started successfully in ${msg}\n`)
printInstructions({urls})
})

Expand Down

0 comments on commit 015c937

Please sign in to comment.