-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Files from static folder not found in dev #1141
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
Comments
That works cause the logo (in a new vue projects) resides in the |
No, I moved it to the static folder. if it were in the assets folder and handled by webpack, it would also be under |
I don't understand why it doesn't seem to work. As I said, I have 2 js files in my projects-root-static-folder. Now when I run dev mode, the files don't seem to be 'virtually' copied to the On building the project, it does work. Can it be there is a bug or something missing from the dev config? |
Hard to say without seeing your actual setup. Your description can't replace that. |
I created a fresh vue project and started testing. It seems scripts and sounds aren't copied at all in dev mode. Pictures like the logo in your example are copied correctly. |
Hm, that's weird. I'll have to check out if this is somethign |
I checked their documentation at https://webpack.js.org/configuration/dev-server/#devserver-publicpath- It says
But even using the forward slashes doesn't seem to work. |
Any update on this issue? Thank you 👍 |
thanks for the reminder. I just did the following:
console.log('This was a successful test!')
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>test-static</title>
</head>
<body>
<div id="app"></div>
<script src="/static/test.js"></script>
<!-- built files will be auto injected -->
</body>
</html> ....and it works: So it works just like expected. I will stop researching this unless you can provide a repository that demonstrates the problem with runnable code. And please don't share a whole project that you worked on - just the bare minimum to demo it. Otherwise, I will close this issue since a reproduction of your problem is not possible. |
I'm not sure if I ran into the same problem. I changed Before you switched to using webpack-dev-server instead of your custom dev server, you had this: https://github.com/nickspiel/webpack/blob/b4b8154a7dbcc469069a94b017dc2d56a429e8f2/template/build/dev-server.js#L57 Now it doesn't work any more because webpack serves all files in the working directory. The working directory is set to the project root when you start the dev server with |
Thanks for the analysis. I came to similar conclusions when researching #1176. That issue is probably more related to your problem. This issue here, according to OP, has an assetPublicPath of '/' which should be fine. I'm still researching horny invest tackle this with webpack-dev-server. If you have any ideas, please share them (in #1176) |
I will close this since there's still no reproduction available And I can't see what's supposed to be wrong. @goowikns Please open a new issue pointing to this one if you can create a repository that actually reproduces the issue |
@nkovacs it works |
Uh oh!
There was an error while loading. Please reload this page.
I seem to be having an issue where in dev mode my static files are not found.
To recap:
assetsPublicPath: '/',
which seem to be an issue in previous vue versions)npm run dev
<script src="/static/scriptname.js"></script>
The built version does work!
The text was updated successfully, but these errors were encountered: