Подключаемый модуль Rollup Serve History API Fallback не работает

Я использую накопительный пакет для своего стройного приложения. Я устанавливаю пакет rollup-plugin-serve от npm к нам historyApiFallback, чтобы я мог обслуживать любой URL-адрес в своем приложении для спа.

https://github.com/thgh/rollup-plugin-serve

моя конфигурация выглядит так:

import serve from 'rollup-plugin-serve'

serve({
   contentBase: 'dist',
   port: 5000,
   historyApiFallback: true,
   historyApiFallback: 'index.html'
}),

Вот мой полный rollup.config.js

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(),
   ],
};

Но этот код не работает. Когда я обслуживаю localhost:5000/solutions/technic, я все равно получаю ошибку 404 Not Found.

Есть идея?


person Niklas    schedule 03.09.2019    source источник


Ответы (1)