我目前正在将我的应用从Webpack迁移到Vite。
我的应用程序正在使用React和Symfony。
所以我遵循了vite-bundle和vite-symfony-plugin的说明。在dev server/local中,一切都运行得很好,但是当我推到我的评论应用程序时,我遇到了问题。
我的树枝渲染没有任何<script>
或<link>
从我的vite_entry_..._tag
。
我的资产被上传到CDN中。
你有什么想法我可以解决这个问题吗?谢谢。
以下是我的vite.config.js
:
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd());
return {
resolve: {
alias: {
// ...
},
},
plugins: [
react(),
symfonyPlugin({
/* defaultValues */
servePublic: true,
refresh: true,
/** If you set server.host: '0.0.0.0' in your vite.config.js
* you have to set 'localhost' */
viteDevServerHostname: null,
}),
],
base: `${env.VITE_PATH_ASSET || ''}/build`,
build: {
outDir: './public/build',
manifest: true,
rollupOptions: {
input: {
// ...
},
},
},
server: {
origin: 'http://localhost:5173',
},
};
});
字符串
1条答案
按热度按时间piwo6bdm1#
如果tig函数返回为空,这意味着入口点有问题。您可以尝试使用
字符串
看看你的
public/build/entrypoints.json
,也许你可以找到信息?型
否则,在https://github.com/lhapaipai/vite-bundle中打开一个讨论,一步一步地重现你的错误:-)