Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The content under public was not copied to the build directory #48

Open
lopo12123 opened this issue Oct 6, 2023 · 5 comments
Open

The content under public was not copied to the build directory #48

lopo12123 opened this issue Oct 6, 2023 · 5 comments

Comments

@lopo12123
Copy link

The content under public was not copied to the build directory. When I was developing, there was a wasm file that needed to be loaded asynchronously (using fetch in background.js), but when I started dev, it did not seem to be copied to In the build directory, I need to assign values manually. Did I miss something to configure?

@lopo12123
Copy link
Author

image

@guocaoyi
Copy link
Owner

guocaoyi commented Oct 7, 2023

add publicDir: 'public', in your vite.config.ts

e.g.

export default defineConfig(({ mode }) => {
  return {
    publicDir: 'public',
    build: {
      emptyOutDir: true,
      outDir: 'build',
      ........

use latest version 0.8.7

@guocaoyi
Copy link
Owner

guocaoyi commented Oct 7, 2023

add publicDir: 'public', in your vite.config.ts

e.g.

export default defineConfig(({ mode }) => {
  return {
    publicDir: 'public',
    build: {
      emptyOutDir: true,
      outDir: 'build',
      ........

use latest version 0.8.7

@lopo12123

@guocaoyi guocaoyi closed this as completed Oct 7, 2023
@lopo12123
Copy link
Author

lopo12123 commented Oct 8, 2023

@guocaoyi Hi there, i'm sure it's not a problem with the publicDir setting, because it defaults to 'public' (I don't need to set it at all). Maybe you can try to reproduce it using the following situation...


Neither example.txt file is copied to the build folder (unless I specify it in web_accessible_resources.resources in manifest.ts)

image

In the picture below, I specified example.txt under public, and you can see that it was copied to build, but icons/example.txt was not (because I did not specify it in web_accessible_resources.resources)
image
image

Then I specified two example.txt, and you can see that they are now copied.
image
image

@guocaoyi
Copy link
Owner

guocaoyi commented Oct 8, 2023 via email

@guocaoyi guocaoyi reopened this Oct 8, 2023
Repository owner deleted a comment from ilkerbrz Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants