Add script post build to check size of integration script is not too big
parent
a553c30c01
commit
025a6ed89a
|
@ -1,4 +1,5 @@
|
|||
import yaml from '@rollup/plugin-yaml'
|
||||
import { statSync } from 'fs'
|
||||
import path from 'path'
|
||||
import { defineConfig } from 'vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
|
@ -16,5 +17,25 @@ export default defineConfig({
|
|||
},
|
||||
emptyOutDir: false,
|
||||
},
|
||||
plugins: [yaml(), VitePWA({ disable: true })],
|
||||
plugins: [
|
||||
yaml(),
|
||||
VitePWA({ disable: true }),
|
||||
{
|
||||
name: 'postbuild-commands',
|
||||
closeBundle: () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
setTimeout(() => {
|
||||
const path = './dist/simulateur-iframe-integration.js'
|
||||
const stats = statSync(path)
|
||||
|
||||
const limit = 5000
|
||||
if (stats.size > limit) {
|
||||
console.error(
|
||||
`Failed to build ${path}, the built file looks too big! (${stats.size} > ${limit})`
|
||||
)
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue