sarsamurmu / reboost

A super fast dev server for rapid web development
MIT License
61 stars 3 forks source link

I feel that reboost should be a robust HMR server. #47

Closed jet10000 closed 3 years ago

jet10000 commented 3 years ago

I just tested it and found that using django's server as the development server, turn off the reboost contentServer setting, and then set ['./src/main.js','./static/dist/main.js'],, then Mapping django's /staic url to the static local folder is more convenient.

What are the advantages of reboost over snowpack?

django + reboost + (svelte + vue + ...) caddy + reboost + (svelte + vue + ...)

Easy to use and quick to get started.

My purpose in doing this is to make full use of the functions of the server-side framework, especially routing, templates, sessions, authentication, etc., and to combine the functions of various front-end languages and frameworks.

very good, I feel that reboost should be a robust HMR server.

const {start, DefaultConfig} = require('reboost');
const SveltePlugin = require('@reboost/plugin-svelte');
const VuePlugin = require('@reboost/plugin-vue');
const PostCSSPlugin = require('@reboost/plugin-postcss');

start({
    entries: [
        ['./src/main.js', './static/dist/main.js'],
    ],
    // contentServer: {
    //   root: './static',
    //   open: false,
    //   proxy: {
    //      '/test': 'http://127.0.0.1:8000',
    //    }
    // },
    // resolve: {
    //     extensions: ['.vue', '.svelte'].concat(DefaultConfig.resolve.extensions),
    //     mainFields: ['svelte', ...DefaultConfig.resolve.mainFields]
    // },
    plugins: [
        SveltePlugin(),
        VuePlugin(),
        PostCSSPlugin({
            // Options
        })
    ]
});

django template

home.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="module" src="{{ url_for('static', path='/dist/main.js') }}"></script>
</head>
<body>
<div id="svelteApp"></div>
<div id="vueApp"></div>
</body>
</html>

django views.py

def home(request):
    return templates.TemplateResponse("/home.html", {"request": request})
sarsamurmu commented 3 years ago

Yes, Reboost is basically a proxy server, which enables Hot Reloading and imports in your modules for development and doesn't handle the production side (for now).

Is it not a HMR server?