-
Notifications
You must be signed in to change notification settings - Fork 54
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
historyApiFallback not working #43
Comments
@UIX-Design do you have a leading forward slash in your |
@GabrielIzaias thanks for your answer, but when i change the script-tag in the I've also tried this: my full import commonjs from 'rollup-plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import postcss from 'rollup-plugin-postcss';
import resolve from 'rollup-plugin-node-resolve';
import svelte from 'rollup-plugin-svelte';
import {terser} from 'rollup-plugin-terser';
import svelte_preprocess_postcss from 'svelte-preprocess-postcss';
import serve from 'rollup-plugin-serve'
const production = !process.env.ROLLUP_WATCH;
export default {
input: 'src/main.js',
output: {
format: 'iife',
sourcemap: true,
name: 'app',
file: 'dist/main.js',
},
plugins: [
svelte({
dev: !production,
preprocess: {
style: svelte_preprocess_postcss(),
},
css: css => {
css.write('dist/components.css');
},
}),
resolve(),
commonjs(),
postcss({
extract: true,
}),
serve({
contentBase: 'dist',
host: 'localhost',
port: 5000,
historyApiFallback: true
}),
!production && livereload('dist'),
production && terser(),
],
}; |
Does that mean you removed the leading forward slash? You have to add it, otherwise any request to a nested route like There doesn't seem to be anything wrong in your |
@GabrielIzaias Yes, when i add the leading forward slash like this How can i solve the issue? |
If you can confirm that the file exists in the file system at the correct path, then Rollup is doing its job. What's your |
@GabrielIzaias i hope we can find my issue my <!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="msapplication-TileColor" content="#4e598c">
<meta name="theme-color" content="#4e598c">
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png">
<link rel="icon" type="image/x-icon" href="/favicon/favicon.ico">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon/favicon-16x16.png">
<link rel="manifest" href="/favicon/site.webmanifest">
<link rel="mask-icon" href="/favicon/safari-pinned-tab.svg" color="#4e598c">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="components.css">
<title>Svelte App</title>
</head>
<body>
<script src="main.js"></script>
</body>
</html> |
Doublecheck that dist/index.html exists and set host is optional |
@thgh thanks for your help, but it doesn't work. my project structure looks like this:
The I set in the serve({
contentBase: 'dist',
port: 5000,
historyApiFallback: 'dist/index.html'
}), and i also tried to run Here are my "scripts": {
"build": "rollup -c",
"build:auto": "rollup -c -w",
"serve": "sirv dist",
"serve:dev": "sirv dist --dev",
"dev": "run-p build:auto serve:dev"
}, |
Try changing historyApiFallback: 'dist/index.html' |
@thgh I'd like to tell you something else, but nothing's changed. |
Could be interesting to make a repo so we can see what's going wrong. |
It's rollup-plugin-serve/src/index.js Line 38 in 0e17e03
The below if statement should be on top then all will be well. If I have time i'll do a pull request for this. |
In fact, this error message should just be removed and let it do a 404 |
Do you mind checking if |
I can confirm the all Also tried |
Hi, thank you very much for this repo. I want to use the plugin for my new svelte spa app.
My config looks like this:
But the
historyApiFallback
isn't working. When i go tolocalhost:5000/solutions/technic
i still get404 Not Found
and i don't see theindex.html
How can i solve this?
The text was updated successfully, but these errors were encountered: