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

Document webpack renderer #256

Closed
nathanfallet opened this issue Dec 13, 2020 · 1 comment
Closed

Document webpack renderer #256

nathanfallet opened this issue Dec 13, 2020 · 1 comment

Comments

@nathanfallet
Copy link

I was trying to migrate to webpack renderer because of a warning on app start, and i noticed it was not evident to do it. It could be great to explain how to do it with more details.

I got issues with expressVue.use() method and res.renderVue() after trying to migrate (which were working before)

@ChanningDefoe
Copy link

ChanningDefoe commented Dec 16, 2020

Here's an example from my app, I struggled with it a bit too. Hope this helps.

expressVue
  .use(app, {
    pagesPath: path.join(__dirname, 'views'),
    head: {
      title: 'App Title',
      styles: [{ style: 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css' }],
      scripts: [
        { src: 'https://js.stripe.com/v3/' },
        { src: 'https://kit.fontawesome.com/b9716c1ee6.js', crossorigin: 'anonymous' },
        { src: 'https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js' },
      ],
    },
  })
  .then((app) => {
    app.use(require('./routes'))

    app.use(function (err, req, res, next) {
      res.status(err.status || 500)

      res.json({
        errors: {
          message: err.message,
          error: err,
        },
      })
    })

    app.listen(config.applicationPort, () => {
      console.log(`App listening at http://localhost:${config.applicationPort}`)
    })
  })

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