@s-ui/bundler 9.41.0 → 9.42.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/bin/sui-bundler-build.js +9 -0
- package/package.json +1 -1
package/bin/sui-bundler-build.js
CHANGED
|
@@ -19,6 +19,7 @@ process.env.NODE_ENV = process.env.NODE_ENV || 'production'
|
|
|
19
19
|
|
|
20
20
|
program
|
|
21
21
|
.option('-C, --clean', 'Remove public folder before create a new one')
|
|
22
|
+
.option('-S, --save-stats', 'Save stats.json in public folder')
|
|
22
23
|
.option(
|
|
23
24
|
'-l, --link-package [package]',
|
|
24
25
|
'Replace each occurrence of this package with an absolute path to this folder',
|
|
@@ -43,6 +44,7 @@ program
|
|
|
43
44
|
const {
|
|
44
45
|
clean = false,
|
|
45
46
|
context,
|
|
47
|
+
saveStats,
|
|
46
48
|
linkPackage: packagesToLink = []
|
|
47
49
|
} = program.opts()
|
|
48
50
|
|
|
@@ -88,6 +90,13 @@ compiler.run(async (error, stats) => {
|
|
|
88
90
|
|
|
89
91
|
console.log(`Webpack stats: ${stats}`)
|
|
90
92
|
|
|
93
|
+
if (saveStats) {
|
|
94
|
+
const filePath = `${process.cwd()}/public/stats.json`
|
|
95
|
+
fs.writeFileSync(filePath, JSON.stringify(stats.toJson(), null, 2), {
|
|
96
|
+
encoding: 'utf8'
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
|
|
91
100
|
const offlinePath = path.join(process.cwd(), 'src', 'offline.html')
|
|
92
101
|
const offlinePageExists = fs.existsSync(offlinePath)
|
|
93
102
|
const {offline: offlineConfig = {}} = projectConfig
|