Closed hellhorse123 closed 5 months ago
I think there can have 2 possible sources of error: the import content would depend on how your bundler is configured. Have you checked that Pocket1
contains the string content of the sdf file?
The second cause is the the loadFile
method can take either a string or a Blob as an argument. If a string is given, it is assumed that's a path. If you need to provide with a file content, it must first be converted to a Blob
stage.loadFile(new Blob([Pocket1], {type: "text/plain"}), {ext:"sdf"})
1) I use vite bundler.
2) I check your second solution
stage.loadFile(new Blob([Pocket1], {type: "text/plain"}), {ext:"sdf"})
and change file name to sdf1.sdf, but again get error:
I dug into the vite.config.js file and added the following code: (I give an example of all the code inside the file)
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
assetsInclude: ['**/*.pdb', '**/*.sdf'], // Include both PDB and SDF files
});
AFter i adding sdf here - my browser code stopped giving an error
In issue #1008 you advised me to add a
{ext:"sdf"}
parameter to the code, I tried it, but the error remained the same. This is strange in principle, because in the codeSandbox example, where I tested exactly the same file, everything worked. Here's a link to it:If necessary, I can upload the zip of my project and the sdf file itself. Now my code look like this:
And this is I get in browser: