Skip to content

Commit

Permalink
feat(packages/sui-bundler): add cacheDir in config
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrés Alvarez authored and Andrés Alvarez committed Jan 4, 2024
1 parent 5a6cae0 commit fd24c71
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions packages/sui-bundler/shared/config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* Extract sui-bundler from package.json -> "config": {"sui-bundler": { ... }} */
const path = require('path')
const {config: packageJsonConfig = {}} = require(`${process.cwd()}/package.json`)

const {'sui-bundler': config = {}} = packageJsonConfig
Expand All @@ -8,3 +9,4 @@ exports.config = config
exports.supportLegacyBrowsers = supportLegacyBrowsers
exports.extractComments = extractComments
exports.sourceMap = (sourcemaps && sourcemaps.prod) || false
exports.cacheDirectory = path.resolve(process.cwd(), '.sui/cache')
4 changes: 2 additions & 2 deletions packages/sui-bundler/webpack.config.client.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {envVars, MAIN_ENTRY_POINT, config, cleanList, when} = require('./shared/i
const definePlugin = require('./shared/define.js')
const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
const {aliasFromConfig, defaultAlias} = require('./shared/resolve-alias.js')
const {supportLegacyBrowsers} = require('./shared/config.js')
const {supportLegacyBrowsers, cacheDirectory} = require('./shared/config.js')

const {resolveLoader} = require('./shared/resolve-loader.js')
const createBabelRules = require('./shared/module-rules-babel.js')
Expand Down Expand Up @@ -52,7 +52,7 @@ const webpackConfig = {
},
cache: {
type: 'filesystem',
cacheDirectory: path.resolve(process.cwd(), '.sui/cache'),
cacheDirectory,
compression: 'gzip'
},
target: 'web',
Expand Down
4 changes: 2 additions & 2 deletions packages/sui-bundler/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {envVars, MAIN_ENTRY_POINT, config, cleanList, when} = require('./shared/i
const definePlugin = require('./shared/define.js')
const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
const {aliasFromConfig, defaultAlias} = require('./shared/resolve-alias.js')
const {supportLegacyBrowsers} = require('./shared/config.js')
const {supportLegacyBrowsers, cacheDirectory} = require('./shared/config.js')

const {resolveLoader} = require('./shared/resolve-loader.js')
const createBabelRules = require('./shared/module-rules-babel.js')
Expand Down Expand Up @@ -54,7 +54,7 @@ const webpackConfig = {
},
cache: {
type: 'filesystem',
cacheDirectory: path.resolve(process.cwd(), '.sui/cache'),
cacheDirectory,
compression: 'gzip'
},
target: 'web',
Expand Down
4 changes: 2 additions & 2 deletions packages/sui-bundler/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const InlineChunkHtmlPlugin = require('./shared/inline-chunk-html-plugin.js')

const {when, cleanList, envVars, MAIN_ENTRY_POINT, config} = require('./shared/index.js')
const {aliasFromConfig} = require('./shared/resolve-alias.js')
const {extractComments, sourceMap, supportLegacyBrowsers} = require('./shared/config.js')
const {extractComments, sourceMap, supportLegacyBrowsers, cacheDirectory} = require('./shared/config.js')
const {resolveLoader} = require('./shared/resolve-loader.js')
const createBabelRules = require('./shared/module-rules-babel.js')
const sassRules = require('./shared/module-rules-sass.js')
Expand Down Expand Up @@ -69,7 +69,7 @@ const webpackConfig = {
},
cache: {
type: 'filesystem',
cacheDirectory: path.resolve(process.cwd(), '.sui/cache'),
cacheDirectory,
compression: false
},
plugins: cleanList([
Expand Down
3 changes: 2 additions & 1 deletion packages/sui-bundler/webpack.config.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const webpackNodeExternals = require('webpack-node-externals')
const path = require('path')

const {config, when, cleanList} = require('./shared/index.js')
const {cacheDirectory} = require('./shared/config.js')
const createBabelRules = require('./shared/module-rules-babel.js')
const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
const {aliasFromConfig} = require('./shared/resolve-alias.js')
Expand Down Expand Up @@ -39,7 +40,7 @@ const webpackConfig = {
},
cache: {
type: 'filesystem',
cacheDirectory: path.resolve(process.cwd(), '.sui/cache'),
cacheDirectory,
compression: !isProduction ? 'gzip' : false
},
externals: [webpackNodeExternals()],
Expand Down

0 comments on commit fd24c71

Please sign in to comment.