Make sure we still convert from CommonJS to ESM even when symlinking `hydrogen-view-sdk` locally (#188)
References: - https://github.com/rollup/plugins/tree/master/packages/commonjs#usage-with-symlinks - https://vitejs.dev/config/shared-options.html#resolve-preservesymlinks - https://github.com/vitejs/vite/issues/2405 -> https://github.com/vitejs/vite/pull/4708/files - https://rollupjs.org/configuration-options/#preservesymlinks
This commit is contained in:
parent
27863a1945
commit
bc900f99b5
|
@ -34,6 +34,12 @@ module.exports = defineConfig({
|
||||||
// See https://css-tricks.com/adding-vite-to-your-existing-web-app/#aa-aliases
|
// See https://css-tricks.com/adding-vite-to-your-existing-web-app/#aa-aliases
|
||||||
'matrix-public-archive-shared': path.resolve(__dirname, '../shared'),
|
'matrix-public-archive-shared': path.resolve(__dirname, '../shared'),
|
||||||
},
|
},
|
||||||
|
// This will make sure Vite/Rollup matches the original file path (i.e. the path
|
||||||
|
// without following symlinks) instead of the real file path (i.e. the path after
|
||||||
|
// following symlinks). This is useful when symlinking `hydrogen-view-sdk`, so it
|
||||||
|
// still matches our `/node_modules/` pattern in the `build.commonjsOptions.include`
|
||||||
|
// config below and gets converted from CommonJS to ESM as expected.
|
||||||
|
preserveSymlinks: true,
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
outDir: './dist',
|
outDir: './dist',
|
||||||
|
|
Loading…
Reference in New Issue