我正在尝试对使用 vite 和 vue3 创建的前端应用程序进行 dockerize。它不作为容器工作。这是错误响应。
(!) 无法从 rollupOptions 或 html 文件自动确定入口点,并且没有显式的 OptimizeDeps.include 模式。跳过依赖项预捆绑。
VITE v3.2.4 ready in 191 ms
➜ Local: http://localhost:5173/
➜ Network: http://172.17.0.2:5173/
(!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling.
Dockerfile
# base image
FROM node:16.3.0-alpine
# set working directory
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY package.json /app/package.json
RUN npm install
RUN npm install @vue/[email protected] /cdn-cgi/l/email-protection -g
# start app
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
vite.config.ts
export default defineConfig({
plugins: [vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
}
}
}
})
index.html
存在于同一目录中vite.config.ts
and .Dockerfile
。提前致谢。