@s-ui/bundler 9.46.0 → 9.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s-ui/bundler",
3
- "version": "9.46.0",
3
+ "version": "9.47.0",
4
4
  "description": "Config-free bundler for ES6 React apps.",
5
5
  "bin": {
6
6
  "sui-bundler": "./bin/sui-bundler.js"
package/shared/config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /* Extract sui-bundler from package.json -> "config": {"sui-bundler": { ... }} */
2
+ const path = require('path')
2
3
  const {config: packageJsonConfig = {}} = require(`${process.cwd()}/package.json`)
3
4
 
4
5
  const {'sui-bundler': config = {}} = packageJsonConfig
@@ -8,3 +9,4 @@ exports.config = config
8
9
  exports.supportLegacyBrowsers = supportLegacyBrowsers
9
10
  exports.extractComments = extractComments
10
11
  exports.sourceMap = (sourcemaps && sourcemaps.prod) || false
12
+ exports.cacheDirectory = path.resolve(process.cwd(), '.sui/cache')
@@ -11,7 +11,7 @@ const {envVars, MAIN_ENTRY_POINT, config, cleanList, when} = require('./shared/i
11
11
  const definePlugin = require('./shared/define.js')
12
12
  const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
13
13
  const {aliasFromConfig, defaultAlias} = require('./shared/resolve-alias.js')
14
- const {supportLegacyBrowsers} = require('./shared/config.js')
14
+ const {supportLegacyBrowsers, cacheDirectory} = require('./shared/config.js')
15
15
 
16
16
  const {resolveLoader} = require('./shared/resolve-loader.js')
17
17
  const createBabelRules = require('./shared/module-rules-babel.js')
@@ -25,6 +25,7 @@ process.env.NODE_ENV = 'development'
25
25
  /** @typedef {import('webpack').Configuration} WebpackConfig */
26
26
 
27
27
  const webpackConfig = {
28
+ name: 'client',
28
29
  mode: 'development',
29
30
  context: path.resolve(PWD, 'src'),
30
31
  resolve: {
@@ -49,6 +50,11 @@ const webpackConfig = {
49
50
  entry: {
50
51
  app: [`webpack-hot-middleware/client?path=${CDN}__webpack_hmr`, MAIN_ENTRY_POINT]
51
52
  },
53
+ cache: {
54
+ type: 'filesystem',
55
+ cacheDirectory,
56
+ compression: 'brotli'
57
+ },
52
58
  target: 'web',
53
59
  optimization: {
54
60
  checkWasmTypes: false,
@@ -9,7 +9,7 @@ const {envVars, MAIN_ENTRY_POINT, config, cleanList, when} = require('./shared/i
9
9
  const definePlugin = require('./shared/define.js')
10
10
  const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
11
11
  const {aliasFromConfig, defaultAlias} = require('./shared/resolve-alias.js')
12
- const {supportLegacyBrowsers} = require('./shared/config.js')
12
+ const {supportLegacyBrowsers, cacheDirectory} = require('./shared/config.js')
13
13
 
14
14
  const {resolveLoader} = require('./shared/resolve-loader.js')
15
15
  const createBabelRules = require('./shared/module-rules-babel.js')
@@ -23,6 +23,7 @@ process.env.NODE_ENV = 'development'
23
23
  /** @typedef {import('webpack').Configuration} WebpackConfig */
24
24
 
25
25
  const webpackConfig = {
26
+ name: 'client-local',
26
27
  mode: 'development',
27
28
  context: path.resolve(PWD, 'src'),
28
29
  resolve: {
@@ -51,6 +52,11 @@ const webpackConfig = {
51
52
  static: outputPath,
52
53
  hot: true
53
54
  },
55
+ cache: {
56
+ type: 'filesystem',
57
+ cacheDirectory,
58
+ compression: 'brotli'
59
+ },
54
60
  target: 'web',
55
61
  optimization: {
56
62
  checkWasmTypes: false,
@@ -11,7 +11,7 @@ const InlineChunkHtmlPlugin = require('./shared/inline-chunk-html-plugin.js')
11
11
 
12
12
  const {when, cleanList, envVars, MAIN_ENTRY_POINT, config} = require('./shared/index.js')
13
13
  const {aliasFromConfig} = require('./shared/resolve-alias.js')
14
- const {extractComments, sourceMap, supportLegacyBrowsers} = require('./shared/config.js')
14
+ const {extractComments, sourceMap, supportLegacyBrowsers, cacheDirectory} = require('./shared/config.js')
15
15
  const {resolveLoader} = require('./shared/resolve-loader.js')
16
16
  const createBabelRules = require('./shared/module-rules-babel.js')
17
17
  const sassRules = require('./shared/module-rules-sass.js')
@@ -35,6 +35,7 @@ const target = supportLegacyBrowsers ? ['web', 'es5'] : 'web'
35
35
  /** @type {WebpackConfig} */
36
36
  const webpackConfig = {
37
37
  devtool: sourceMap,
38
+ name: 'client',
38
39
  mode: 'production',
39
40
  target,
40
41
  context: path.resolve(CWD, 'src'),
@@ -66,6 +67,11 @@ const webpackConfig = {
66
67
  minimizer: [minifyJs({extractComments, sourceMap}), minifyCss()].filter(Boolean),
67
68
  runtimeChunk: true
68
69
  },
70
+ cache: {
71
+ type: 'filesystem',
72
+ cacheDirectory,
73
+ compression: false
74
+ },
69
75
  plugins: cleanList([
70
76
  new webpack.ProvidePlugin({
71
77
  process: 'process/browser'
@@ -3,6 +3,7 @@ const webpackNodeExternals = require('webpack-node-externals')
3
3
  const path = require('path')
4
4
 
5
5
  const {config, when, cleanList} = require('./shared/index.js')
6
+ const {cacheDirectory} = require('./shared/config.js')
6
7
  const createBabelRules = require('./shared/module-rules-babel.js')
7
8
  const manifestLoaderRules = require('./shared/module-rules-manifest-loader.js')
8
9
  const {aliasFromConfig} = require('./shared/resolve-alias.js')
@@ -12,10 +13,13 @@ const filename = '[name].[chunkhash:8].js'
12
13
 
13
14
  /** @typedef {import('webpack').Configuration} WebpackConfig */
14
15
 
16
+ const isProduction = process.env.NODE_ENV === 'production'
17
+
15
18
  /** @type {WebpackConfig} */
16
19
  const webpackConfig = {
20
+ name: 'server',
17
21
  context: path.resolve(process.cwd(), 'src'),
18
- mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
22
+ mode: isProduction ? 'production' : 'development',
19
23
  resolve: {
20
24
  alias: {...aliasFromConfig},
21
25
  extensions: ['.js', '.json'],
@@ -34,6 +38,11 @@ const webpackConfig = {
34
38
  minimize: true,
35
39
  nodeEnv: false
36
40
  },
41
+ cache: {
42
+ type: 'filesystem',
43
+ cacheDirectory,
44
+ compression: !isProduction ? 'brotli' : false
45
+ },
37
46
  externals: [webpackNodeExternals()],
38
47
  plugins: [new webpack.DefinePlugin({'global.GENTLY': false})],
39
48
  resolveLoader,