How can we provide content for specific links #145
Answered
by
meteorlxy
Mister-Hope
asked this question in
Q&A
-
In V1, we can use Providing a manifest file: {
beforeDevServer(app) {
app.get(`${base || "/"}manifest.webmanifest`, (_req, res) => {
getManifest(pwaOption, app)
.then((manifest) => {
res.send(manifest);
})
.catch(() =>
res.status(500).send("Unexpected manifest generate error")
);
});
},
} How can we do that now after beforeDevServer is removed? The scene describe above is quite common for plugins which generate files during the build process. These plugins should provide content while the devServer is running for the best experience. |
Beta Was this translation helpful? Give feedback.
Answered by
meteorlxy
May 20, 2021
Replies: 1 comment 1 reply
-
If you want it anyway: // for vite
if (app.env.isDev && app.options.bundler.endsWith('vite')) {
app.options.bundlerConfig.viteOptions = require('vite').mergeConfig(
app.options.bundlerConfig.viteOptions,
{
// ...
}
)
}
// for webpack
if (app.env.isDev && app.options.bundler.endsWith('webpack')) {
const currentBeforeDevServer = app.options.bundlerConfig.beforeDevServer
app.options.bundlerConfig.beforeDevServer = (...args) => {
// ...
currentBeforeDevServer(...args)
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Mister-Hope
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want it anyway: