mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-06 23:30:28 +03:00
Fix vite build to place element-call correctly for embedded npm package support
This commit is contained in:
parent
4c8ab4e79d
commit
d3ec9facf6
1 changed files with 9 additions and 6 deletions
|
|
@ -14,9 +14,9 @@ import buildConfig from './build.config';
|
||||||
const copyFiles = {
|
const copyFiles = {
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
src: 'node_modules/@element-hq/element-call-embedded/dist',
|
src: 'node_modules/@element-hq/element-call-embedded/dist/*',
|
||||||
dest: 'element-call'
|
dest: 'public/element-call',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
src: 'node_modules/pdfjs-dist/build/pdf.worker.min.mjs',
|
src: 'node_modules/pdfjs-dist/build/pdf.worker.min.mjs',
|
||||||
dest: '',
|
dest: '',
|
||||||
|
|
@ -51,7 +51,10 @@ function serverMatrixSdkCryptoWasm(wasmFilePath) {
|
||||||
configureServer(server) {
|
configureServer(server) {
|
||||||
server.middlewares.use((req, res, next) => {
|
server.middlewares.use((req, res, next) => {
|
||||||
if (req.url === wasmFilePath) {
|
if (req.url === wasmFilePath) {
|
||||||
const resolvedPath = path.join(path.resolve(), "/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm");
|
const resolvedPath = path.join(
|
||||||
|
path.resolve(),
|
||||||
|
'/node_modules/@matrix-org/matrix-sdk-crypto-wasm/pkg/matrix_sdk_crypto_wasm_bg.wasm'
|
||||||
|
);
|
||||||
|
|
||||||
if (fs.existsSync(resolvedPath)) {
|
if (fs.existsSync(resolvedPath)) {
|
||||||
res.setHeader('Content-Type', 'application/wasm');
|
res.setHeader('Content-Type', 'application/wasm');
|
||||||
|
|
@ -106,8 +109,8 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
devOptions: {
|
devOptions: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
type: 'module'
|
type: 'module',
|
||||||
}
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue