After running `make cockpit/devel`, the generated files do not pass `npm run build`, outputing failures and making dev console and output of `npm run build` cluttered with errors.
This excludes `/pkg` folder during build time, removing the errors.
this commmit enable useFileHash in fec.config.js -
when set it to true Webpack will append a hash (a unique identifier) to the filename based on its content.
This helps prevent the browser from using an outdated cached version of a file when its content has changed.
It was necessary to do a bit of plumbing to get typescript, webpack &
vitest all happy. To do this we had had to create a separate tsconfig
for the on-prem version and the service frontend.
We override the module resolution for both config files. For on-prem we
check modules in `pkg/lib` and for the service we resolve the modules to
stub functions of the `cockpit` & `cockpit/fsinfo` modules. This was so
typescript and webpack would not complain.
For on-prem we had to intruct webpack to resolve modules from both
`node_modules` and `pkg/lib`. While for the service we set the
resulotion for the two modules to false, which means they won't get
bundled with the service.
Lastly, we needed to set some aliases in the vitest config so that
vitest could resolve the `cockpit` & `cockpit/fsinfo` modules.
Using the cjs `require` keyword to import cockpit would have worked to
make typescript and webpack compile since these imports are not
statically analysed like the `import` keyword is. However, this approach
broke the tests as `require` imports are not supported in vitest.
I misunderstood, this is for legacy sourcemaps only, the new method uses
debug IDs which are embedded and don't rely on url paths to resolve the
sources.
This reverts commit 2410143ba0.
This migrates from previously used webpack configs to one fec.config.js.
This will allow us to bump `frontend-components-config` dependency to version 6.x and stay supported in the future.
2024-07-19 16:55:25 +02:00
Renamed from config/dev.webpack.config.js (Browse further)